[Insight-users] confused behavior of itk image origin with
FlipImageFilter
kdsfinger at gmail.com
kdsfinger at gmail.com
Sun Dec 24 03:34:01 EST 2006
hi, there
To make things simple, let's define two 4x2 (2D) images: img0 and
img1. Both with spacing 1mm on x and y direction.
img0 has pixel value
1 2 3 4
5 6 7 8
img0 has origin (0,0).
img1 is produced by a FlipImageFilter with img0 as input and flip on x
axis, thus img1 has pixel value
4 3 2 1 // We call this configuration
8 7 6 5 // confA.
After flipping of img0, img1 has origin (-3, 0). (Why?)
Experiment 1:
I output img1 and it shows as confA.
Later, I set the origin of img1 to (0,0) and output img1, it still
shows as confA.
Experiment 2:
I resample img1 with identity transformation and output the result, it
shows as confA.
Later, I set the origin of img1 to (0,0) and resample img1 with
identity transformation and output the result, it still shows as
confA.
Here is the code for resampling:
--------------------------
resampler->SetTransform( identityTransform );
resampler->SetInput( img1 );
resampler->SetSize( img1->GetLargestPossibleRegion().GetSize() );
resampler->SetOutputOrigin( img1->GetOrigin() );
resampler->SetOutputSpacing( img1->GetSpacing() );
resampler->SetDefaultPixelValue( 100 );
---------------------------
My question is: If I change the origin of an image and resample it
based on the new origin, the result must be different from the
original one (image shifted). Why in this case, with the origin
changed, there is no difference for the output? What is the exact
defination of origin and how to use it correctly? I do read the
softwareguide but still can't explain why.
Thanks for help.
zl2k
More information about the Insight-users
mailing list