[Insight-users] Questions about Getting Started with ITK+VTK

Jeffrey Li chyumm at yahoo.com
Fri, 9 Apr 2004 09:46:13 -0700 (PDT)


--0-362075654-1081529173=:56592
Content-Type: text/plain; charset=us-ascii

Dear Luis,
 
I've solved the problem but it seemed wield to me. I copied the file to the C drive, and modified the code to "C:Circle.png", it worked! I saw that picture. And I tried "C:\Circle.png", the warning message showed out, but it also worked fine. I even tried to copy the file to an external hard disc (F drive), and everything was fine with both "F:Circle.png" and "F:\Circle.png". It really looks wield to me. Seems there are some problems with my D drive. I installed the itk and vtk on the D drive, will it be the problem? 
 
Thanks a lot!
 
Sincerely,
 
Jeff

Luis Ibanez <luis.ibanez at kitware.com> wrote:

Hi Jeffrey,

The error message seems to be clear enough,
your program is not finding the input image
file "./circle.png". Therefore it cannot
feed the rest of the pipeline.

When the ImageFileReader can't locate a file,
it throws and ITK exception, that is then
converted to a Python exception (thanks to
Charl Botha who took the time of making this
connection).


So the problem is related to the line:

> reader->SetFileName( "D:circle.png");

meaning that this filename doesn't seems
to be valid. You probably want to try
"D:\circle.png" if the file is actually
in the root directory of the "D:" drive.



Regards,



Luis


------------------
Jeffrey Li wrote:

> Dear all,
> 
> I'm a beginner of ITK and VTK. I got a problem when I ran the example named
> " Getting Started Two", the "Getting Started with ITK+VTK". The compilation
> was alright, but the program crashed in run time. The error message's
> "Couldn't open file ./circle.png". I tried to debug it. When I commented
> out the sentence "viewer->SetInput( connector->GetOutput() );", it worked
> fine, and a small black window came out. Did anyone meet the same problem?
> Is the sample correct?
> 
> P.S. My working environment is .Net 2003
> 
> Thanks a lot!
> 
> Attached is the code
> 
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> #include "itkImageToVTKImageFilter.h"
> #include "itkImageFileWriter.h"
> 
> #include "vtkImageViewer.h"
> #include "vtkRenderWindowInteractor.h"
> 
> int main( int argc, char **argv ) {
> 
> typedef itk::Image ImageType;
> typedef itk::ImageFileReader ReaderType;
> typedef itk::ImageToVTKImageFilter ConnectorType;
> typedef itk::ImageFileWriter WriterType;
> 
> ReaderType::Pointer reader = ReaderType::New();
> ConnectorType::Pointer connector = ConnectorType::New();
> WriterType::Pointer writer = WriterType::New();
> 
> reader->SetFileName( "D:circle.png");
> connector->SetInput( reader->GetOutput() );
> 
> vtkImageViewer * viewer = vtkImageViewer::New();
> 
> vtkRenderWindowInteractor * renderWindowInteractor =
> vtkRenderWindowInteractor::New();
> 
> viewer->SetInput( connector->GetOutput() );
> 
> viewer->SetColorWindow( 255 );
> viewer->SetColorLevel( 128 );
> viewer->SetupInteractor( renderWindowInteractor );
> 
> viewer->Render();
> renderWindowInteractor->Start();
> 
> return 0;
> }
> 
> J. Li
> 
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Yahoo! Small Business $15K Web Design Giveaway 
> 
> - Enter today



---------------------------------
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway - Enter today
--0-362075654-1081529173=:56592
Content-Type: text/html; charset=us-ascii

<DIV>
<DIV>Dear Luis,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I've solved the problem but it seemed wield to me. I copied the file to the C drive, and modified the code to "C:Circle.png", it worked! I saw that picture. And I tried "C:\Circle.png", the warning message showed out, but it also worked fine. I even tried to copy the file to an external hard disc (F drive), and everything was fine with both "F:Circle.png" and "F:\Circle.png". It really looks wield to me. Seems there are some problems with my D drive. I installed the itk and vtk&nbsp;on the D drive, will it be the problem? </DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks a lot!</DIV>
<DIV>&nbsp;</DIV>
<DIV>Sincerely,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Jeff</DIV>
<DIV><BR><B><I>Luis Ibanez &lt;luis.ibanez at kitware.com&gt;</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>Hi Jeffrey,<BR><BR>The error message seems to be clear enough,<BR>your program is not finding the input image<BR>file "./circle.png". Therefore it cannot<BR>feed the rest of the pipeline.<BR><BR>When the ImageFileReader can't locate a file,<BR>it throws and ITK exception, that is then<BR>converted to a Python exception (thanks to<BR>Charl Botha who took the time of making this<BR>connection).<BR><BR><BR>So the problem is related to the line:<BR><BR>&gt; reader-&gt;SetFileName( "D:circle.png");<BR><BR>meaning that this filename doesn't seems<BR>to be valid. You probably want to try<BR>"D:\circle.png" if the file is actually<BR>in the root directory of the "D:" drive.<BR><BR><BR><BR>Regards,<BR><BR><BR><BR>Luis<BR><BR><BR>------------------<BR>Jeffrey Li wrote:<BR><BR>&gt; Dear all,<BR>&gt; <BR>&gt; I'm a beginner of ITK and VTK. I got a problem when I ran the example named<BR>&gt;
 " Getting Started Two", the "Getting Started with ITK+VTK". The compilation<BR>&gt; was alright, but the program crashed in run time. The error message's<BR>&gt; "Couldn't open file ./circle.png". I tried to debug it. When I commented<BR>&gt; out the sentence "viewer-&gt;SetInput( connector-&gt;GetOutput() );", it worked<BR>&gt; fine, and a small black window came out. Did anyone meet the same problem?<BR>&gt; Is the sample correct?<BR>&gt; <BR>&gt; P.S. My working environment is .Net 2003<BR>&gt; <BR>&gt; Thanks a lot!<BR>&gt; <BR>&gt; Attached is the code<BR>&gt; <BR>&gt; #include "itkImage.h"<BR>&gt; #include "itkImageFileReader.h"<BR>&gt; #include "itkImageToVTKImageFilter.h"<BR>&gt; #include "itkImageFileWriter.h"<BR>&gt; <BR>&gt; #include "vtkImageViewer.h"<BR>&gt; #include "vtkRenderWindowInteractor.h"<BR>&gt; <BR>&gt; int main( int argc, char **argv ) {<BR>&gt; <BR>&gt; typedef itk::Image <UNSIGNED char,2>ImageType;<BR>&gt; typedef itk::ImageFileReader
 <IMAGETYPE>ReaderType;<BR>&gt; typedef itk::ImageToVTKImageFilter <IMAGETYPE>ConnectorType;<BR>&gt; typedef itk::ImageFileWriter <IMAGETYPE>WriterType;<BR>&gt; <BR>&gt; ReaderType::Pointer reader = ReaderType::New();<BR>&gt; ConnectorType::Pointer connector = ConnectorType::New();<BR>&gt; WriterType::Pointer writer = WriterType::New();<BR>&gt; <BR>&gt; reader-&gt;SetFileName( "D:circle.png");<BR>&gt; connector-&gt;SetInput( reader-&gt;GetOutput() );<BR>&gt; <BR>&gt; vtkImageViewer * viewer = vtkImageViewer::New();<BR>&gt; <BR>&gt; vtkRenderWindowInteractor * renderWindowInteractor =<BR>&gt; vtkRenderWindowInteractor::New();<BR>&gt; <BR>&gt; viewer-&gt;SetInput( connector-&gt;GetOutput() );<BR>&gt; <BR>&gt; viewer-&gt;SetColorWindow( 255 );<BR>&gt; viewer-&gt;SetColorLevel( 128 );<BR>&gt; viewer-&gt;SetupInteractor( renderWindowInteractor );<BR>&gt; <BR>&gt; viewer-&gt;Render();<BR>&gt; renderWindowInteractor-&gt;Start();<BR>&gt; <BR>&gt; return 0;<BR>&gt; }<BR>&gt; <BR>&gt; J.
 Li<BR>&gt; <BR>&gt; ------------------------------------------------------------------------<BR>&gt; Do you Yahoo!?<BR>&gt; Yahoo! Small Business $15K Web Design Giveaway <BR>&gt; <HTTP: evt="23609/*http://promotions.yahoo.com/design_giveaway/static/index2.html" us.rd.yahoo.com><BR>&gt; - Enter today<BR></BLOCKQUOTE></DIV><p><hr size=1><font face=arial size=-1>Do you Yahoo!?<br>
<a href="http://us.rd.yahoo.com/evt=23609/*http://promotions.yahoo.com/design_giveaway/static/index2.html">Yahoo! Small Business $15K Web Design Giveaway</a> - Enter today
--0-362075654-1081529173=:56592--