Resampling Image in ITK.

I am trying to do a resampling on my PNG image series. I am using this ITK code…

My original Image size is 512 x 546. X-range is -512 to -1 (delta 511 )and Y range is -546 to -1 (delta 545 )
I am giving 240 X 240 as new image dimension. Using this dimensions it calculates the spacing is 2.00 .
But after resampling I can see that though the dimension is changed in 240 x 240 but the X-range is -180 to -329(delta 509 ) and Y range is -180 to -363 (delta 543 ). I mean the total image is still as bigger as the original one. Could you please help me out how to fix this problem I mean how to change the X range and Y range like -180 to 60 and -180 to 60.

Thanks in adcance

What you might try is manually setting the spacing to 1.0 in the example you mentioned. A more general approach is to transform you image by a matrix which does scaling by 0.5 in both dimensions, based on this example.

1 Like