[Insight-users] file reader

Gwenaël Guillard gwenael.guillard@enst-bretagne.fr
Mon, 13 Jan 2003 17:12:21 +0100


--------------71A4285A0F1718F0AFDAC25B
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Luis,

Sorry, the message was
    Acces violation - no RTTI data!

Gwenael



Luis Ibanez a écrit :

> Hi Gwenael
>
> Please print out the expression returned by the exception.
>
> This will let you know what kind of problem prevents the
> file from being read.
>
> Your try/catch exception should look like
>
>    try
>    {
>      Load( filename );
>    }
>    catch( itk::ExceptionObject & ecp )
>    {
>     std::cerr << "Exception caught" << std::endl;
>     std::cerr << ecp << std::endl;
>    }
>    catch(...)
>    {
>    std::cerr << "Unknown exception caught !" << std::endl;
>    }
>
> Also, note that you no longer need to create the
> MetaImageIO object nor set it to the reader. Now the
> image filename extension is used to figure out what
> kind of ImageIO object to use. As long as you use
> ".mha" or ".mhd" the reader will be able to find its
> way.
>
> Creating the MetaImageIO is only needed if you want
> to select specific options of this format.
>
> Please let us know what you find in the error message
> of the exception.
>
>     Thanks
>
>        Luis
>
> ------------------------------------------
>
> Gwenaël Guillard wrote:
>
> > Hi,
> >
> > Thank you for your answer. You are right, the Update( ) is after but the
> > problem is still there. It seems that the Update( ) method send an
> > exception
> > The code is
> >
> >
> > In the main method
> >
> >
> >           try
> >           {
> >             Load( filename );
> >           }
> >           catch( ... )
> >           {
> >             fl_message("Problem reading the files");
> >           }
> >
> >
> > In Load( ) Method
> >
> >
> >           VolumeReaderType::Pointer Reader = VolumeReaderType::New();
> >
> >           itk::MetaImageIO::Pointer metaImageIO = itk::MetaImageIO::New();
> >           Reader->SetImageIO( metaImageIO );
> >
> >           Reader->SetFileName( filename );
> >           printf("avant GetOutput\n");
> >
> >           PixelType width, height;
> >           width =
> >         Reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0];
> >           height =
> >         Reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1];
> >
> >           Reader->Update();
> >           printf("after Update()\n");
> >
> >
> > It never writes "after Update()" but it shows the alert message. I'm
> > able to get width and height  (0 for both because the update is not done
> > yet as you said). So the problem is when the update is called. I try my
> > data on gaussianFilter and there wasn't any problem.
> >
> > Gwenael
> >
> >
>
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users

--
-----------------------------------------------------------
Gwenael Guillard
Doctorant
Departement Image et Traitement de l'Information (ITI)
LAboratoire  de Traitement de l'Information Medicale (LATIM) - INSERM ERM 0102
ENST Bretagne
Technopole Brest Iroise
BP 832 - 29285 Brest Cedex
Tel : 02 29 00 13 01
email : gwenael.guillard@enst-bretagne.fr, g.guillard@ieee.org



--------------71A4285A0F1718F0AFDAC25B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Luis,
<p>Sorry, the message was
<br>&nbsp;&nbsp;&nbsp; Acces violation - no RTTI data!
<p>Gwenael
<br>&nbsp;
<br>&nbsp;
<p>Luis Ibanez a &eacute;crit :
<blockquote TYPE=CITE>Hi Gwenael
<p>Please print out the expression returned by the exception.
<p>This will let you know what kind of problem prevents the
<br>file from being read.
<p>Your try/catch exception should look like
<p>&nbsp;&nbsp; try
<br>&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp;&nbsp; Load( filename );
<br>&nbsp;&nbsp; }
<br>&nbsp;&nbsp; catch( itk::ExceptionObject &amp; ecp )
<br>&nbsp;&nbsp; {
<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Exception caught" &lt;&lt; std::endl;
<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; ecp &lt;&lt; std::endl;
<br>&nbsp;&nbsp; }
<br>&nbsp;&nbsp; catch(...)
<br>&nbsp;&nbsp; {
<br>&nbsp;&nbsp; std::cerr &lt;&lt; "Unknown exception caught !" &lt;&lt;
std::endl;
<br>&nbsp;&nbsp; }
<p>Also, note that you no longer need to create the
<br>MetaImageIO object nor set it to the reader. Now the
<br>image filename extension is used to figure out what
<br>kind of ImageIO object to use. As long as you use
<br>".mha" or ".mhd" the reader will be able to find its
<br>way.
<p>Creating the MetaImageIO is only needed if you want
<br>to select specific options of this format.
<p>Please let us know what you find in the error message
<br>of the exception.
<p>&nbsp;&nbsp;&nbsp; Thanks
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luis
<p>------------------------------------------
<p>Gwena&euml;l Guillard wrote:
<p>> Hi,
<br>>
<br>> Thank you for your answer. You are right, the Update( ) is after
but the
<br>> problem is still there. It seems that the Update( ) method send an
<br>> exception
<br>> The code is
<br>>
<br>>
<br>> In the main method
<br>>
<br>>
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Load( filename );
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(
... )
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
fl_message("Problem reading the files");
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>>
<br>>
<br>> In Load( ) Method
<br>>
<br>>
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VolumeReaderType::Pointer
Reader = VolumeReaderType::New();
<br>>
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; itk::MetaImageIO::Pointer
metaImageIO = itk::MetaImageIO::New();
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reader->SetImageIO(
metaImageIO );
<br>>
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reader->SetFileName(
filename );
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("avant
GetOutput\n");
<br>>
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PixelType
width, height;
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width
=
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0];
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height
=
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1];
<br>>
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Reader->Update();
<br>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("after
Update()\n");
<br>>
<br>>
<br>> It never writes "after Update()" but it shows the alert message.
I'm
<br>> able to get width and height&nbsp; (0 for both because the update
is not done
<br>> yet as you said). So the problem is when the update is called. I
try my
<br>> data on gaussianFilter and there wasn't any problem.
<br>>
<br>> Gwenael
<br>>
<br>>
<p>_______________________________________________
<br>Insight-users mailing list
<br>Insight-users@public.kitware.com
<br><a href="http://public.kitware.com/mailman/listinfo/insight-users">http://public.kitware.com/mailman/listinfo/insight-users</a></blockquote>

<pre>--&nbsp;
-----------------------------------------------------------
Gwenael Guillard
Doctorant
Departement Image et Traitement de l'Information (ITI)
LAboratoire&nbsp; de Traitement de l'Information Medicale (LATIM) - INSERM ERM 0102
ENST Bretagne
Technopole Brest Iroise
BP 832 - 29285 Brest Cedex
Tel : 02 29 00 13 01
email : gwenael.guillard@enst-bretagne.fr, g.guillard@ieee.org</pre>
&nbsp;</html>

--------------71A4285A0F1718F0AFDAC25B--