[Insight-users] Changing itk.Examples.Registration.Translation1.cs to work with 3d images

Luis Ibanez luis.ibanez at kitware.com
Sun Apr 18 14:03:14 EDT 2010


Hi Carl,

Thanks for letting us know that
you found the solution to the current problem.

Please let us know if you run into any other difficulties.


      Thanks


            Luis


---------------------------------------------------------------------
On Fri, Apr 16, 2010 at 7:32 AM, Carl Bateman <Carl.Bateman at icr.ac.uk>wrote:

> Hi Luis,
>
> thanks for getting back to me.
>
> I think I get it now. (I just changed all the types and got an output image
> with the same format as the input, so that's a good sign.)
>
> Presumably, it would also be possible to use a caster, to cast from UC* to
> US*.
>
> This is all pretty new to me so your help has been much appreciated.
>
> Regards,
>
> Carl
>
> >>> Luis Ibanez <luis.ibanez at kitware.com> 16/04/2010 02:05 >>>
> Hi Carl,
>
> Thanks for posting the information about your images.
>
> As you describe it, the image size (in bytes) is consistent
> with the image size in pixels and the pixel type.
>
> ---
>
> Regarding the pixel type:  ITK readers will convert the
> pixel type of the input image into the pixel type of the
> image type that you use for instantiating the reader.
>
> For example, if you have an image of pixel type
>
>                unsigned char
>
> and you load it into an image of pixel type float,
> then the reader with cast the pixel values from
> unsigned char to float by using the default casting
> rules of the C Language.
>
> Note that this also applies if the image file is of
> pixel type float, and the image type is unsigned char,
> with the standard problem that the float numbers will
> be truncated to unsigned char (and in many cases
> precision will be lost).
>
> If you have an image file of pixel type unsigned short,
> and you load it into an image of pixel type unsigned
> char, then you only capture the lower byte of every
> pixel. Therefore you will end up with a corrupted
> image.
>
> If you want to preserve the original image information
> you MUST load the image using a reader instantiated
> using an image type that matches *exactly* the pixel
> type of the image contained in the file.
>
>
>
>      Regards,
>
>
>            Luis
>
>
> ---------------------------------------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100418/de83f884/attachment.htm>


More information about the Insight-users mailing list