[Insight-users] Reading and writing 16bit grayscale images
Sims Richard (RKB) Clinical Scientist
Richard.Sims at uhcw.nhs.uk
Tue Feb 20 11:28:40 EST 2007
Hi Christoph,
Thanks for reply.
I have found that I needed to set the ElementByteOrderMSB = True in the
metaimage header - the VHuman data is of big endian format.
Incidentally, regarding the header of the raw data file, I have found out
that one can include the following line in a mha file to omit the first X
bytes of a raw data file:
HeaderSize = X
And therefore I no longer need to load the raw data into ImageJ!
All the best,
Richard.
-----Original Message-----
From: Christoph Palm [mailto:christoph.palm at web.de]
Sent: 20 February 2007 15:41
To: Sims Richard (RKB) Clinical Scientist
Cc: 'insight-users at itk.org'
Subject: Re: [Insight-users] Reading and writing 16bit grayscale images
Hi Richard,
did you also adapted the OutputPixelType to unsigned int?
Regards
Christoph
On Tue, 2007-02-20 at 14:18 +0000, Sims Richard (RKB) Clinical Scientist
wrote:
> Hi
>
>
>
> I am using the example code ImageReadCastWrite.cxx
> from /ITK/Examples/IO/ to read uint16 data in the form of a raw data
> file and attempting to write a uint16 dcm file. It appears to work ok
> but when I attempt to visualise the contents of the dcm file there is
> a problem with the pixel values.
>
>
>
> I edited the original example code to change the following line:
>
>
>
> filter->SetOutputMaximum( 255 );
>
>
>
> to:
>
>
>
> filter->SetOutputMaximum( 65535 );
>
>
>
> to ensure that the output is 16bit and not 8bit... but this
> unfortunately doesn't change the dcm file - it's the same size and the
> value remains as uint8.
>
>
>
> If I convert the raw data file to uint8 at the very beginning, and
> leave the filter maximum at 255, the dcm file looks fine.
>
>
>
> Can anyone help? Am I missing something simple?
>
>
>
> Thanks in advance,
>
> Richard.
>
>
DISCLAIMER: This e-mail and any attachments hereto are confidential and may
contain proprietary information or be legally privileged. This e-mail is for
the exclusive use of the intended recipient(s) only. If you are not the
intended recipient(s) you must not use, copy, print or rely on this message
or any attachment or disclose the content to any other person. If you have
received this e-mail in error please notify the author by replying to this
e-mail or contact us on info at uhcw.nhs.uk.
More information about the Insight-users
mailing list