[Insight-users] What is a good image format for ITK?

Mathieu Malaterre Mathieu . Malaterre at creatis . insa-lyon . fr
Wed, 28 May 2003 10:17:56 +0200


Hideaki Hiraki,
	
	I am sorry but I can't reproduce the bug you mention. I am also sorry 
to ask you this question: Are you sure you change:


   typedef float               InputPixelType;
into
   typedef char               InputPixelType;

in the file ImageReadCastWrite.cxx ?

Mathieu


hhiraki at lab . nig . ac . jp wrote:
> Hi Mathieu,
> 
> I tried a cvs version. It's on a pentium3 linux box with gcc-3.2.
> Thanks to Stephen R. Aylward, MetaImageIO had already fixed. The 
> other two can be reproduced with Examples/IO/ImageCastReadWrite.cxx
> and Examples/Data/BrainT1Slice.png.
> 
> 
> On VTKImageIO, as the default format had been changed to binary, 
> ImageCastReadWrite.cxx had to be changed to reproduce the flaw.
> Fow example:
> 
> --- ImageReadCastWrite.cxx~	Wed May 28 14:49:52 2003
> +++ ImageReadCastWrite.cxx	Wed May 28 15:06:27 2003
> @@ -205,6 +205,8 @@
>    try 
>      { 
>      writer->Update(); 
> +    writer->GetImageIO()->SetFileTypeToASCII();
> +    writer->Update(); 
>      } 
>    catch( itk::ExceptionObject & err ) 
>      { 
> 
> Then try:
> 
> $ ImageReadCastWrite BrainT1Slice.png foobar.vtk
> 
> The result file foobar.vtk causes an error in VTK:
> 
> $ vtk
> % vtkStructuredPointsReader reader
> reader
> % reader SetFileName foobar.vtk
> % reader Update
> Generic Warning: In /tmp/src/VTK/IO/vtkDataReader.cxx, line 833
> Error reading ascii data!
> 
> 
> On AnalyzeImageIO, convert the image through AnalyzeIO:
> 
> $ ImageReadCastWrite BrainT1Slice.png foobar.hdr
> $ ImageReadCastWrite foobar.hdr foobar.png
> 
> Then, the grayscale of the result foobar.png was overflowed at 
> the value 128. 
> 
> 
> By the way, I think signed 8bit integer pixel type must be
> explicit "signed char" rather than platform-dependent "char".
> 
> Regards,
> 
> Hideaki Hiraki
> 
> 
> Mathieu Malaterre wrote:
> 
>>Hideaki Hiraki,
>>
>>There has been quite a lot of bug fix since ITK1.2 in all of the ImageIO 
>>you are talking about:
>>
>>http://public . kitware . com/cgi-bin/cvsweb . cgi/Insight/Code/IO/itkVTKImageIO . cxx?cvsroot=Insight
>>http://public . kitware . com/cgi-bin/cvsweb . cgi/Insight/Code/IO/itkAnalyzeImageIO . cxx?cvsroot=Insight
>>http://public . kitware . com/cgi-bin/cvsweb . cgi/Insight/Code/IO/itkMetaImageIO . cxx?cvsroot=Insight
>>
>>Could you please try a CVS version of ITK ? And if this is still not 
>>working could you give us a short example on how to reproduce each bugs, 
>>thanks ?
>>
> 
> 


-- 
Mathieu Malaterre
CREATIS
28 Avenue du Doyen LEPINE
B.P. Lyon-Montchat
69394 Lyon Cedex 03
http://www . creatis . insa-lyon . fr/~malaterre/