[Insight-users] Attempt to rotate image resulting in black image.
Michael Jackson
mike.jackson at bluequartz.net
Thu Jun 4 10:12:49 EDT 2009
The code provided does not seem to work in my case. I still get an all
black image. It would seem that I am translating or rotating the
original image "off canvas" and so nothing is showing up. Just not
sure what is going wrong.
On Jun 3, 2009, at 8:42 PM, Luis Ibanez wrote:
>
>
> Hi Michael,
>
>
> We define as "Origin" of an image the physical coordinates of its
> pixel with index [0,0,0].
>
> Rotations, are performed by default, with respect to the origin
> of the coordinate system (the point with physical coordinates
> (0.0, 0.0, 0.0), which doesn't have to coincide with the first
> pixel of the image, nor with the central pixel of the image.
>
> In ITK we assume that your image is a representation of some
> physical reality (for example a patient's body), and therefore
> all transformations should be performed in the context of the
> physical coordinates, not the grid of pixels.
>
> The purpose of the "Origin" is that if you use your physical
> image acquisition device (microscope, telescope, CT scanner,
> MRI scanner, ultrasound device, lidar...) and you acquire
> images of different sections of an object that has a physical
> manifestation in the real world, then you should be able to
> recreate a mosaic of such real object by simply placing the
> images in a common coordinate system according to the coordinates
> of their origin.
>
>
> ----
>
>
> In order to understand the behavior of the transformations,
> you should think of your image in the context of the physical
> coordinate system.
>
> If you want your image to rotate around the one of the pixel
> in one of the image corners the you should do the following:
>
>
> A) Compute the Index of that pixel
>
> B) Call image->TransformIndexToPhysicalPoint( index, point )
> to compute the physical coordinates corresponding to this
> pixel. This transformation will take into account the
> image origin, pixel spacing and image orientation.
>
> C) Call transform->SetCenter( point )
> to tell the transform that you want to use this point
> as the center of rotation.
>
> D) Connect the transform to the resample filter.
>
> E) call Update() in the resample filter.
>
>
>
> Please let us know if you still find any problem,
>
>
> Thanks,
>
>
> Luis
>
>
More information about the Insight-users
mailing list