[Insight-users] Big endian/little endian
Radhika Sivaramakrishna
radhika.sivaramakrishna at synarc.com
Wed Jun 16 17:41:39 EDT 2004
Hi Luis,
I did try this but it is still writing this out as little endian. Is there a
way to force it to write in big endian format or force byte swapping?
Thanks
Radhika
-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Wednesday, June 16, 2004 12:53 PM
To: Radhika Sivaramakrishna
Cc: 'ITK'
Subject: Re: [Insight-users] Big endian/little endian
Hi Radhika,
Yes, you can specify the desired Endian-ness
when writing the image.
You simple need to create the ImageIO object
on your own (not let the ImageIO factory do it
for you) and invoke on it any of the following
methods:
SetByteOrder (ByteOrder _arg)
SetByteOrderToBigEndian ()
SetByteOrderToLittleEndian ()
These methods are defined in ImageIOBase
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ImageIOBase.html
The code will look like
typedef itk::MetaImageIO ImageIOType;
ImageIOType::Pointer metaIO = ImageIOType::New();
metaIO->SetByteOrderToBigEndian();
// XOR
metaIO->SetByteOrderToLittleEndian();
typedef itk::ImageFileWriter< ImageType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetImageIO( imageIO );
writer->SetFileName("myfilename.mhd");
writer->SetInput( filter->GetOutput() );
writer->Update();
Regards,
Luis
--------------------------------
Radhika Sivaramakrishna wrote:
> Hi there,
>
> When writing out an image, is there a way to specify the desired
> Endian-ness of the output image file?
>
> Thanks
>
> Radhika
>
>
>
> -----------------------------------------------------
>
> Confidentiality Notice.
>
> This email message is for the sole use of the intended recipient(s) and
> may contain confidential and privileged information. Any unauthorized
> review, use, disclosure or distribution is prohibited. If you are not
> the intended recipient, please contact the sender by reply email and
> destroy all copies of the original message. If you are the intended
> recipient, please be advised that the content of this message is subject
> to access, review and disclosure by the sender's Email System
Administrator.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
-----------------------------------------------------
Confidentiality Notice.
This email message is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. If you are the intended recipient, please be
advised that the content of this message is subject to access, review and
disclosure by the sender's Email System Administrator.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20040616/e836042d/attachment.html
More information about the Insight-users
mailing list