[Insight-users] Convert the Image Format

Luis Ibanez luis.ibanez at kitware.com
Mon Nov 8 20:30:56 EST 2004



Hi Weihua,

You are using the wrong extension for the header.

You are using ".hdr" as extension, but you are
writing a header for a MetaImage.



Please use extension ".mhd" as indicated in the Data link

     http://www.itk.org/HTML/Data.htm



The extension ".hdr" corresponds to "Analyze" header files,
as explaind in the FAQ

     http://www.itk.org/Wiki/Itk_FAQ





With the example

    Insight/Examples/IO/ImageSeriesReadWrite.cxx

you can write MetaImages if you provide a file name
with extension ".mhd" as output filename,  and you
can write Analyze images if you provide a filename
with extension ".hdr" as output filename.

The invokation in the command line is as simple as:


   ImageSeriesReadWrite  10 20  visibleWoman.mhd

or as in:

   ImageSeriesReadWrite  10 20  visibleWoman.hdr


The MultiResMIRegistration application *DO* read
any type of 3D fileformat supported by ITK
(please read the FAQ for a list of such formats).

You can simply verify this by looking at the set
of input files in the directory:

   InsightApplications/
         MultiResMIRegistration/
                          SampleInputs


for example, look at the file  BrainWebT1toT2a.txt
that uses ".mhd" images as input.


You could equally feed it with VTK, GIPL, or Analyze
images.



Regards,



    Luis


----------------------
weihuax at sfu.ca wrote:

> Hi:
> 
> 
> I used the MATLAB to create a 'raw' file, 
> 
> 
> 
> 
>>>aaa = rand(10,10,10) * 100;
> 
> 
>>>fid = fopen('test.raw','wb');
> 
> 
>>>fwrite(fid,aaa,'ushort');
> 
> 
>>>fclose(fid);
> 
> 
> 
> 
> And create a Corresponding 'test.hdr' file  for it,
> 
> 
> 
> NDims = 3 
> 
> DimSize = 10 10 10
> 
> ElementType = MET_USHORT 
> 
> ElementByteOrderMSB = False 
> 
> Position = 0 0 0
> 
> ElementSize = 1 1 1 
> 
> ElementDataFile = test.raw 
> 
> 
> 
> But when I use the Paraview to open such MetaImage, I can not open it, can
> you tell  me the potential reason?
> 
> 
> 
> The other question is:
> 
> Insight/Examples/IO/ImageSeriesReadWrite.cxx do not creat any 'raw' and
> 'hdr' files, but from the MI examples, I find that it always read '.hdr'
> file. Does 'MI' application read other format 3D volumn file, e,g, can it
> read the output file from the
> 'Insight/Examples/IO/ImageSeriesReadWrite.cxx'.  
> 
> 
> 
> Thanks
> 
> 
> 
> Weihua
> 
>  
> 
> On Sun, 07 Nov 2004 08:50:39 -0500 luis.ibanez at kitware.com wrote:
> 
> 
> 
>>Hi Weihua,
> 
> 
> 
>>You can use the example program:
> 
> 
> 
>>	  Insight/Examples/IO/
> 
> 
>>			       ImageSeriesReadWrite.cxx
> 
> 
> 
>>in order to convert your series of slices into a 3D volume.
> 
> 
> 
> 
>>  Regards,
> 
> 
> 
> 
>>	Luis
> 
> 
> 
> 
>>---------------------------
> 
> 
>>weihuax at sfu.ca wrote:
> 
> 
> 
>>>Hi;
> 
> 
> 
>>>Thanks a lot for quick reply. Now I have another question: Now I want 
> 
> 
>>to use
> 
> 
>>>'MultiResMIRegistration' application, its input are TWO 3-D volume,
> 
> 
>>how can
> 
> 
>>>I create my own 3-D volume format as its input?
> 
> 
> 
>>>Thank again
> 
> 
> 
>>>Weihua
> 
> 
> 
>>>On Sat, 06 Nov 2004 20:05:58 -0500 luis.ibanez at kitware.com wrote:
> 
> 
>>> 
> 
> 
> 
>>>>Hi Weihua,
> 
> 
> 
>>>>You don't need to convert your JPEG files to MetaImage in order
> 
> 
>>>>to use the registration methods available in ITK.
> 
> 
> 
>>>>You can read JPEG images directly using the ImageFileReader<>.
> 
> 
> 
>>>>Any of the 2D examples in the ITK Software Guide can be
> 
> 
>>>>run using JPEG images as input. You can also use BMP, TIFF,
> 
> 
>>>>PNG, GPIL, VTK and Analyze.
> 
> 
> 
>>>>Please read the IO chapter of the  Software Guide
> 
> 
> 
>>>>	http://www.itk.org/ItkSoftwareGuide.pdf
> 
> 
> 
>>>>and take a look at the Tutorial Sessions:
> 
> 
> 
>>>>	 http://www.itk.org/HTML/Tutorials.htm
> 
> 
> 
>>>>In particular the first session: "Getting Started I"
> 
> 
> 
> http://www.itk.org/CourseWare/Training/GettingStartedI-WebPage/index.htm
> 
> 
>>>>	
> 
> 
> 
> 
>>> 
> 
> 
> 
>>>>For a full list of the Image formats supported in ITK,
> 
> 
>>>>please take a look at the FAQ:
> 
> 
> 
>>>>	http://www.itk.org/Wiki/ITK_FAQ
> 
> 
> 
>>>>in particular to the entry:
> 
> 
> 
> 
> 
>>>> Regards,
> 
> 
> 
>>>>	 Luis
> 
> 
> 
> 
>>>>------------------------------
> 
> 
>>>>weihuax at sfu.ca wrote:
> 
> 
> 
>>>>	
> 
> 
> 
>>>>>Hi:
> 
> 
> 
>>>>>I am a new user for itk. Now I used the Matlab to create a 3D '.JPG'
> 
> 
>>>>>	   
> 
> 
> 
>>>>file, 
> 
> 
>>>>	
> 
> 
> 
>>>>>D = rand(2,3,4);
> 
> 
>>>>>imwrite(D,'test.jpg');
> 
> 
> 
>>>>>Who can tell me how to create such .jpg file into MetaIMage File
> 
> 
>>>>>	   
> 
> 
> 
>>>>(including
> 
> 
>>>>	
> 
> 
> 
>>>>>test.hdr and test.raw) so that some itk registration solution can
> 
> 
>>use it.
> 
> 
>>>>>	   
> 
> 
> 
> 
>>> 
> 
> 
> 
>>>>>Thanks a lot
> 
> 
> 
>>>>>Weihua(Wallace) Xiong
> 
> 
> 
>>>>>_______________________________________________
> 
> 
>>>>>Insight-users mailing list
> 
> 
>>>>>Insight-users at itk.org
> 
> 
>>>>>http://www.itk.org/mailman/listinfo/insight-users
> 
> 
> 
> 
> 
>>>>>	   
> 
> 
> 
> 
> 
> 
>>>>	
> 
> 
> 
> 
> 
>>>rt.3F
> 
> 
> 
> 
>>> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>>http://www.itk.org/Wiki/ITK_FAQ#What_3D_file_formats_can_ITK_import_and_exp
> 
> o
> 
> 
> 
> 






More information about the Insight-users mailing list