<br>Hi Carl,<br><br>Thanks for letting us know that <br>you found the solution to the current problem.<br><br>Please let us know if you run into any other difficulties.<br><br><br>      Thanks<br><br><br>            Luis<br>
<br><br>---------------------------------------------------------------------<br><div class="gmail_quote">On Fri, Apr 16, 2010 at 7:32 AM, Carl Bateman <span dir="ltr">&lt;<a href="mailto:Carl.Bateman@icr.ac.uk">Carl.Bateman@icr.ac.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">Hi Luis,<br>
<br>
thanks for getting back to me.<br>
<br>
</div>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&#39;s a good sign.)<br>
<br>
Presumably, it would also be possible to use a caster, to cast from UC* to US*.<br>
<br>
This is all pretty new to me so your help has been much appreciated.<br>
<br>
Regards,<br>
<br>
Carl<br>
<br>
&gt;&gt;&gt; Luis Ibanez &lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>&gt; 16/04/2010 02:05 &gt;&gt;&gt;<br>
<div><div></div><div class="h5">Hi Carl,<br>
<br>
Thanks for posting the information about your images.<br>
<br>
As you describe it, the image size (in bytes) is consistent<br>
with the image size in pixels and the pixel type.<br>
<br>
---<br>
<br>
Regarding the pixel type:  ITK readers will convert the<br>
pixel type of the input image into the pixel type of the<br>
image type that you use for instantiating the reader.<br>
<br>
For example, if you have an image of pixel type<br>
<br>
                unsigned char<br>
<br>
and you load it into an image of pixel type float,<br>
then the reader with cast the pixel values from<br>
unsigned char to float by using the default casting<br>
rules of the C Language.<br>
<br>
Note that this also applies if the image file is of<br>
pixel type float, and the image type is unsigned char,<br>
with the standard problem that the float numbers will<br>
be truncated to unsigned char (and in many cases<br>
precision will be lost).<br>
<br>
If you have an image file of pixel type unsigned short,<br>
and you load it into an image of pixel type unsigned<br>
char, then you only capture the lower byte of every<br>
pixel. Therefore you will end up with a corrupted<br>
image.<br>
<br>
If you want to preserve the original image information<br>
you MUST load the image using a reader instantiated<br>
using an image type that matches *exactly* the pixel<br>
type of the image contained in the file.<br>
<br>
<br>
<br>
      Regards,<br>
<br>
<br>
            Luis<br>
<br>
<br>
---------------------------------------------------------------------<br></div></div></blockquote></div>