[Insight-developers] Raw image IO factory?

Stephen R. Aylward aylward@unc.edu
Sat, 01 Feb 2003 09:43:18 -0500


Sure - this is an easy change to make.   I'll test the last letter of 
the filename, and if it is a 'd' or if the user has specified a 
dataFileName via the member function, then the files are split; if the 
last letter is an 'a' the files are kept together.

I'm finishing a paper today, perhaps I'll get to the tomorrow...but it 
is suppose to be 68 degrees here tomorrow... :)

Stephen

Luis Ibanez wrote:
> Jim,
> 
> That's great !,
> actually that's the best solution since you get the raw
> file and the header independently.
> 
> For extesions, MetaImage right now accepts both
> ".mha" and ".mhd" without any distinction.
> 
> Originally they were intended to be used depending
> on whether the binary data was in the same file as
> the header or not.
> 
> Actually we could enforce this now, in order to help
> the MetaImageIO decide whether it has to save the
> binary file appart just based on the filename extension.
> 
> Stephen, what do you think ?
> 
> Could this make sense ?
> 
> 
> Luis
> 
> 
> ====================================================
> 
> 
> Miller, James V (Research) wrote:
> 
>> Luis,
>>
>> Using the meta image format as an output factory worked for me.  So 
>> I'll use that.
>>
>> What extension should I use?  It seems to respond to both
>> "mha" and "mhd".
>>
>> Jim
>>
>>
>>
>>
>>> -----Original Message-----
>>> From: Miller, James V (Research) Sent: Friday, January 31, 2003 2:03 PM
>>> To: 'Luis Ibanez'
>>> Cc: Insight-developers (E-mail)
>>> Subject: RE: [Insight-developers] Raw image IO factory?
>>>
>>>
>>> I guess what I what is to be able to write out a raw image using a 
>>> factory.  I want a command
>>> line program that does
>>>
>>> ./MyProgram input.png output.raw
>>>
>>> and have it write out a raw image.  And if I do
>>>
>>> ./MyProgram input.png output.png
>>>
>>> it would write a png file.
>>>
>>> I agree that you loose the spacing and size, etc. But I am trying to 
>>> do a quick and dirty integration of an ITK algorithm
>>> to a legacy system and want to just rig up an IPC process.  So
>>> my existing app tells my ITK app to run on a particular input
>>> file and output a particular output file which it will then read 
>>> (since they app already knows the size and spacing, it can just do a 
>>> bulk read).
>>>
>>> Can I use the Meta image as an output factory?  If so, that will
>>> do what I want.
>>>
>>>
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: Luis Ibanez [mailto:luis.ibanez@kitware.com]
>>>> Sent: Friday, January 31, 2003 1:53 PM
>>>> To: Miller, James V (Research)
>>>> Cc: Insight-developers (E-mail)
>>>> Subject: Re: [Insight-developers] Raw image IO factory?
>>>>
>>>>
>>>> Hi Jim,
>>>>
>>>> The problem with Raw is that even if we set a factory
>>>> that figures out the correct ImageIO from the file
>>>> extension, there is no easy way to arrange for the
>>>> additional image information to be passed to the
>>>> ImageIO.
>>>>
>>>> In the current mode for raw, the user has to instantiate
>>>> the RawImageIO object, pass the spacing, size and origin
>>>> of the image, and then trigger the execution of the reader.
>>>>
>>>> I personaly think that being so easy to create a MetaImage
>>>> header or a VTK header for a raw file, we should rather
>>>> encourage users to use those mechanism as a way of 'wrapping'
>>>> a raw file.
>>>>
>>>> At the end of the day, a 'raw' image is an incomplete
>>>> file and there is no way to figure out the content
>>>> without the additional information.
>>>>
>>>>
>>>>
>>>>   Luis
>>>>
>>>>
>>>> -----------------------------------------
>>>>
>>>> Miller, James V (Research) wrote:
>>>>
>>>>
>>>>> Should there be a raw image IO factory for raw images?
>>>>>
>>>>>
>>>>>
>>>>> There is no RawImageIOFactory in the system.  Currently the
>>>>
>>>> RawImageIO
>>>>
>>>>> object says it can write a file as long as there is a
>>>>
>>>> filename.  So I
>>>>
>>>>> imagine this is why there is not a corresponding
>>>>
>>> RawImageIOFactory
>>>
>>>>> (since it would respond yes to everything).
>>>>>
>>>>>
>>>>> But when running in factory mode, could a RawImageIOFactory
>>>>
>>>> respond to
>>>>
>>>>> being able to read/write files if the extension is ".raw"?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *Jim Miller*
>>>>> */_____________________________________/*
>>>>> /Visualization & Computer Vision//
>>>>> /GE Research/
>>>>> /Bldg. KW, Room C218B/
>>>>> /P.O. Box 8, Schenectady NY 12301/
>>>>>
>>>>> //_millerjv@research.ge.com <mailto:millerjv@research.ge.com>_/
>>>>>
>>>>> /_james.miller@research.ge.com_/
>>>>> /(518) 387-4005, Dial Comm: 8*833-4005, /
>>>>> /Cell: (518) 505-7065, Fax: (518) 387-6981/
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> _______________________________________________
>>> Insight-developers mailing list
>>> Insight-developers@public.kitware.com
>>> http://public.kitware.com/mailman/listinfo/insight-developers
>>>
>>>
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers@public.kitware.com
>> http://public.kitware.com/mailman/listinfo/insight-developers
>>
>>
> 
> 
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers


-- 
===============================================
Dr. Stephen R. Aylward
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://caddlab.rad.unc.edu
aylward@unc.edu
(919) 966-9695