[Insight-developers] MetaImage Test failing on Mac

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Jul 7 10:58:51 EDT 2009


Hello,

Can some one apply this path to the metaio library?

I build an experimental build with the attached patch for the metaio  
library:
http://www.cdash.org/CDash/buildSummary.php?buildid=372755

After the patch is applied to the utility library, I can then file  
itkMetaImageIO with:
m_MetaImage.ElementByteOrderFix( m_IORegion.GetNumberOfPixels() );

Then the dash board will look better again :)

Brad




On Jul 6, 2009, at 11:56 AM, Stephen Aylward wrote:

> I'd rather see it fixed in metaIO - going outside of metaIO to call  
> a function just to avoid a bug in metaIO seems like a bad idea :)
>
> Seems like backward compatibility can be preserved.  Add an arg to  
> ElementByteOrderFix that is the buffer size, but have it default to  
> 0 which implies use the full buffer (I know, I hate such hidden  
> "features" but I'd rather preserve backward compatibility and metaIO  
> performs such badness elsewhere so it is almost a design pattern :) ).
>
> Thanks for catching this!!!
>
> Stephen
>
> On Mon, Jul 6, 2009 at 11:50 AM, Bradley Lowekamp <blowekamp at mail.nih.gov 
> > wrote:
> Hello,
> 	
> 	I remember this test now, it did not work right when I first  
> encountered it.
>
> 1) The itkMetaImageStreamingWriterIOTest2:
>
> # This test is failing to produce correct output
> ADD_TEST(itkMetaImageStreamingWriterIOTest2 ${IO_TESTS}
> #  --compare ${ITK_DATA_ROOT}/Input/mri3D.mhd
> #            ${ITK_TEST_OUTPUT_DIR}/mri3DWriteStreamed.mha
>   itkMetaImageStreamingWriterIOTest
>             ${ITK_DATA_ROOT}/Input/mri3D.mhd
>             ${ITK_TEST_OUTPUT_DIR}/mri3DWriteStreamed.mha)
>
> The input mha file references a dcm file. And meta IO does not  
> support streaming from that format well. Before I made any changes  
> to the streaming IO, this test was passing, but not producing the  
> correct output file on all systems.
>
> 2) The cause of the segfault is that MetaImage::ElementByteOrderSwap  
> assumes the size of the buffer is the size of the  image, but in the  
> case of streaming this is not true. This problem could have been  
> encountered before I made the recent changes to ImageFileReader. I  
> see two possible solutions, A) add a MetaImage function to take the  
> buffer size as a parameter, or B) have itkMetaImageIO not call  
> MetaImage::ElementByteOrderFix, but instead call an  
> itk::ByteSwapper. I think option B would be easiest.
>
> Brad
>
>
> -- 
> Stephen R. Aylward, Ph.D.
> Director of Medical Imaging
> Kitware, Inc. - North Carolina Office
> http://www.kitware.com
> (518) 371-3971 x300 (NY Line)
> (919) 969-6990 x300 (NC Line)
> stephen.aylward (Skype)

========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090707/bc7047a3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: metaio_swap.patch
Type: application/octet-stream
Size: 2885 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090707/bc7047a3/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090707/bc7047a3/attachment-0001.htm>


More information about the Insight-developers mailing list