[Insight-developers] Exceptions with ImageFileWriter

Miller, James V (Research) millerjv at crd.ge.com
Fri Sep 3 09:58:48 EDT 2004


A frequent question with ITK users is why do their programs crash
when the go to write a file.  The cause is usually that the specified
a filename does not have an extension.  Since the IO factories trigger on 
extension and no matching extension is found, an exception is thrown.

What do people think about adding a "default" format? If no IO 
factory is found that likes the extension specified, we write the 
data out in a default preferred format (and add the default extension).
We should probably also output a warning to the effect that a format
could not be found and that we are using a default format instead.
  
To support intensity and vector data, perhaps the default could be 
something like MetaImage.

Just a thought to reduce the number of initial frustrations people have.

Jim


-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Thursday, September 02, 2004 6:46 PM
To: uday kurkure
Cc: insight-users at itk.org; Ting Chen
Subject: Re: [Insight-users] Re: Deformable Model


Hi Uday,

What filename are you passing to the writer ?

It is common for writers to throw exceptions
when they do not recognize the file format
from the filename that you pass....

You should try adding a try/catch block around
the code that is throwing the exception, and
print the message that you get.


You will find multiple examples on how to catch
exceptions in the ITK Software Guide


   http://www.itk.org/ItkSoftwareGuide.pdf



Please let us know what you find.


   Thanks



     Luis


--------------------
Ting Chen wrote:

> Hi! As someone has already mentioned, it would be better you add an
> exception handle there. I never met such problems with the gradient
filter.
> You may ask other experts for more help.
> 
> ting
> ----- Original Message -----
> From: "uday kurkure" <udaykurkure at yahoo.com>
> To: <insight-users at itk.org>
> Sent: Wednesday, August 25, 2004 5:50 PM
> Subject: [Insight-users] Re: Deformable Model
> 
> 
> 
>>Hello all,
>>
>>To overcome the previous problem, I have removed the
>>command line arguements. Now I have the arguements
>>hard coded in the program.
>>
>>But I get exception handling error in the step:
>>"gradientMapFilter->Update();"
>>
>>I tried to write the gradient magnitude image to check
>>if it is correct before going to the gradientMapFilter
>>but I am getting the same error in:
>>"writer->Update()".
>>
>>So, I guess there is some problem in the update
>>function. Any helpful suggestions to overcome this
>>problem are welcome.
>>
>>Thanks
>>Uday
>>
>>
>>
>>
>>__________________________________
>>Do you Yahoo!?
>>New and Improved Yahoo! Mail - 100MB free storage!
>>http://promotions.yahoo.com/new_mail
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk.org
>>http://www.itk.org/mailman/listinfo/insight-users
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 




_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-developers mailing list