
function translateImage ()
{    
    var translationString = ctx.field("translationTagValue").value;
    
    if (translationString.length > 0){
    
        // parse translation string
        var splitString = translationString.split("\\");
    
        var xTrans = splitString[0];
        var yTrans = splitString[1];
        var zTrans = splitString[2];   
    
        // get original image matrix
        var a00 = ctx.field("Info.a00").value;
        var a01 = ctx.field("Info.a01").value;
        var a02 = ctx.field("Info.a02").value;
        var a03 = ctx.field("Info.a03").value;
    
        var a10 = ctx.field("Info.a10").value;
        var a11 = ctx.field("Info.a11").value;
        var a12 = ctx.field("Info.a12").value;
        var a13 = ctx.field("Info.a13").value;
        
        var a20 = ctx.field("Info.a20").value;
        var a21 = ctx.field("Info.a21").value;
        var a22 = ctx.field("Info.a22").value;
        var a23 = ctx.field("Info.a23").value;
        
        var a30 = ctx.field("Info.a30").value;
        var a31 = ctx.field("Info.a31").value;
        var a32 = ctx.field("Info.a32").value;
        var a33 = ctx.field("Info.a33").value;
    
        // modify translation according to DCM tag
        a03 = a03 - xTrans;
        a13 = a13 - yTrans;
        a23 = a23 - zTrans;
    
        // set modified image matrix
        ctx.field("ImgPropConvert.a00").value = a00;
        ctx.field("ImgPropConvert.a01").value = a01;
        ctx.field("ImgPropConvert.a02").value = a02;
        ctx.field("ImgPropConvert.a03").value = a03;
        
        ctx.field("ImgPropConvert.a10").value = a10;
        ctx.field("ImgPropConvert.a11").value = a11;
        ctx.field("ImgPropConvert.a12").value = a12;
        ctx.field("ImgPropConvert.a13").value = a13;
        
        ctx.field("ImgPropConvert.a20").value = a20;
        ctx.field("ImgPropConvert.a21").value = a21;
        ctx.field("ImgPropConvert.a22").value = a22;
        ctx.field("ImgPropConvert.a23").value = a23;
        
        ctx.field("ImgPropConvert.a30").value = a30;
        ctx.field("ImgPropConvert.a31").value = a31;
        ctx.field("ImgPropConvert.a32").value = a32;
        ctx.field("ImgPropConvert.a33").value = a33;
    }
}

//# MeVis signature v1
//# key: MFowDQYJKoZIhvcNAQEBBQADSQAwRgJBAL7SwKNHkHBgB9qUD4diwRQbzCvcmo5tOThuQpDaNbbnER+0rr4pvcNBFPryRY4cWd6PoeyJo5hbomE3XIM5LbsCARE=:aBiq8DiLE2yV5zrB7kV6AaR9N2l9ufzF1dUU9eeV6gX/Bo6rwms1p+87SmalYNHOF2kWEFnNO9FJ5n4BJUVPQg==
//# owner: STU
//# date: 2009-08-14T12:07:37
//# hash: iBGIUO1SZP4CiO/GrDlAVx5UDjcZMoan8ZyLAY6cM9XNwPU8SPKLgKH7dGVQ29VFkQGDb4zNM38Q/6oGfpsW8g==
//# MeVis end
