[Insight-users] file reader
Gwenaël Guillard
gwenael.guillard@enst-bretagne.fr
Mon, 13 Jan 2003 16:51:29 +0100
--------------9E960C90998B2C497DE28F58
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
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
Luis Ibanez a écrit :
> Hi Gwenael,
>
> Did you call "Update()" on the reader ?
>
> The output of filters is not valid until
> an Update() call has been issued on them.
> Please make sure that you call "Update()"
> before calling "GetOutput()" on a reader.
>
> You will find many examples of Read/Write
> operations in the Insight/Examples directory.
>
> In particular on the directories:
>
> Examples/Filtering
> Examples/IO
>
> You may also want to take a look at the
> SoftwareGuide.pdf document:
> http://public.kitware.com/Insight/Web/HTML/SoftwareGuide.pdf
>
> In particular the chapters:
>
> - "Filtering"
> - "Reading and Writting Images"
>
> Please let us know if you have further questions,
>
> Thanks
>
> Luis
>
> ------------------------------------
>
> Gwenaël Guillard wrote:
>
> > Hi,
> >
> > I try to use a file reader. I wrote, as in the GaussianFilter example
> >
> > VolumeReaderType::Pointer Reader = VolumeReaderType::New();
> > itk::MetaImageIO::Pointer metaImageIO = itk::MetaImageIO::New();
> > Reader->SetImageIO( metaImageIO );
> > Reader->SetFileName( filename );
> >
> > But when I want to get
> > Reader->GetOutput()->GetLargestPossibleRegion()->GetSize(), for example,
> > it gives me 0,0,0, which is not
> > the dimensions of my data. These data are .rwa and I use a mhd file. I
> > use the mhd file with the GaussianFilter example and it was
> > ok.
> >
> > Thank you,
> >
> > 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
--------------9E960C90998B2C497DE28F58
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<p>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
<br>The code is
<br>
<p>In the main method
<br>
<blockquote>
<blockquote> try
<br> {
<br> Load( filename );
<br> }
<br> catch( ... )
<br> {
<br> fl_message("Problem reading the files");
<br> }</blockquote>
</blockquote>
<p><br>In Load( ) Method
<br>
<blockquote>
<blockquote> VolumeReaderType::Pointer Reader = VolumeReaderType::New();
<br>
<br> itk::MetaImageIO::Pointer metaImageIO = itk::MetaImageIO::New();
<br> Reader->SetImageIO( metaImageIO );
<p> Reader->SetFileName( filename );
<br> printf("avant GetOutput\n");
<br>
<br> PixelType width, height;
<br> width = Reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0];
<br> height = Reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1];
<p> Reader->Update();
<br> printf("after Update()\n");</blockquote>
</blockquote>
<p><br>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.
<p>Gwenael
<br>
<br>
<p>Luis Ibanez a écrit :
<blockquote TYPE=CITE>Hi Gwenael,
<p>Did you call "Update()" on the reader ?
<p>The output of filters is not valid until
<br>an Update() call has been issued on them.
<br>Please make sure that you call "Update()"
<br>before calling "GetOutput()" on a reader.
<p>You will find many examples of Read/Write
<br>operations in the Insight/Examples directory.
<p>In particular on the directories:
<p> Examples/Filtering
<br> Examples/IO
<p>You may also want to take a look at the
<br>SoftwareGuide.pdf document:
<br><a href="http://public.kitware.com/Insight/Web/HTML/SoftwareGuide.pdf">http://public.kitware.com/Insight/Web/HTML/SoftwareGuide.pdf</a>
<p>In particular the chapters:
<p>- "Filtering"
<br>- "Reading and Writting Images"
<p>Please let us know if you have further questions,
<p> Thanks
<p> Luis
<p>------------------------------------
<p>Gwenaël Guillard wrote:
<p>> Hi,
<br>>
<br>> I try to use a file reader. I wrote, as in the GaussianFilter example
<br>>
<br>> VolumeReaderType::Pointer
Reader = VolumeReaderType::New();
<br>> itk::MetaImageIO::Pointer
metaImageIO = itk::MetaImageIO::New();
<br>> Reader->SetImageIO( metaImageIO
);
<br>> Reader->SetFileName( filename
);
<br>>
<br>> But when I want to get
<br>> Reader->GetOutput()->GetLargestPossibleRegion()->GetSize(), for example,
<br>> it gives me 0,0,0, which is not
<br>> the dimensions of my data. These data are .rwa and I use a mhd file.
I
<br>> use the mhd file with the GaussianFilter example and it was
<br>> ok.
<br>>
<br>> Thank you,
<br>>
<br>> Gwenael
<br>>
<br>>
<br>> _______________________________________________
<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>
<br>>
<br>></blockquote>
<pre>--
-----------------------------------------------------------
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</pre>
</html>
--------------9E960C90998B2C497DE28F58--