[Insight-users] reading-writing .mhd + raw data
Zoltan Seress
seress.zoltan at gmail.com
Mon Aug 10 04:11:18 EDT 2009
Hi Luis!
Next morning I managed to solve the problem, but thanks the exhaustive
answer.
On Sat, Aug 8, 2009 at 6:57 PM, Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
> Hi Zoltan,
>
> There are three pixel types involved here:
>
> 1. The PixelType of the image in the input file
> 2. The PixelType that you used to declare your image in your program
> 3. The PixelType of the image in the output file
>
> The itkImageFileReader, by default converts the pixel type of the input
> image
> (1) to the pixel of the image that you declared in your code (2), then when
> you
> write the image to disk, the pixel type of the output image (3) will be
> exactly
> the same used in the typedef in your code (2).
>
>
> Therefore, the reason why your output image is of type USHORT is that you
> probably used in your code a typedef similar to:
>
> typedef unsigned short PixelType;
> typedef itk::Image< PixelType, Dimension > ImageType;
> typedef itk::ImageFileReader< ImageType > ReaderType;
>
> If you know that your input image is of pixel type: UCHAR
> then you should use a declaration such as:
>
> typedef unsigned char PixelType;
>
>
>
> Regards,
>
>
> Luis
>
>
> ----------------------------------------
>
> On Wed, Aug 5, 2009 at 10:33 AM, Zoltan Seress <seress.zoltan at gmail.com>wrote:
>
>> Dear members!
>> I am a newbie in ITK and I ran into an annoying problem. I try to read raw
>> data (obtained from brainweb) with the support of its .mhd header, then
>> write it without any modification as it is presented in the user's guide.
>> But at the end the resulted .mhd contains different information
>> about ElementType, namely the original MET_UCHAR is replaced with
>> MET_USHORT, what's more the resulted raw data size decreases. What is hidden
>> in the background?
>> Thanks in advance!
>>
>> Cheers,
>> --
>> Zoltan Seress
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>
--
Zoltan Seress
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090810/1ab436f9/attachment.htm>
More information about the Insight-users
mailing list