[Insight-users] Big endian/little endian

Luis Ibanez luis.ibanez at kitware.com
Wed Jun 16 15:52:34 EDT 2004


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





More information about the Insight-users mailing list