[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> </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 on the D drive, will it be the problem? </DIV>
<DIV> </DIV>
<DIV>Thanks a lot!</DIV>
<DIV> </DIV>
<DIV>Sincerely,</DIV>
<DIV> </DIV>
<DIV>Jeff</DIV>
<DIV><BR><B><I>Luis Ibanez <luis.ibanez at kitware.com></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>> reader->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>> Dear all,<BR>> <BR>> I'm a beginner of ITK and VTK. I got a problem when I ran the example named<BR>>
" Getting Started Two", the "Getting Started with ITK+VTK". The compilation<BR>> was alright, but the program crashed in run time. The error message's<BR>> "Couldn't open file ./circle.png". I tried to debug it. When I commented<BR>> out the sentence "viewer->SetInput( connector->GetOutput() );", it worked<BR>> fine, and a small black window came out. Did anyone meet the same problem?<BR>> Is the sample correct?<BR>> <BR>> P.S. My working environment is .Net 2003<BR>> <BR>> Thanks a lot!<BR>> <BR>> Attached is the code<BR>> <BR>> #include "itkImage.h"<BR>> #include "itkImageFileReader.h"<BR>> #include "itkImageToVTKImageFilter.h"<BR>> #include "itkImageFileWriter.h"<BR>> <BR>> #include "vtkImageViewer.h"<BR>> #include "vtkRenderWindowInteractor.h"<BR>> <BR>> int main( int argc, char **argv ) {<BR>> <BR>> typedef itk::Image <UNSIGNED char,2>ImageType;<BR>> typedef itk::ImageFileReader
<IMAGETYPE>ReaderType;<BR>> typedef itk::ImageToVTKImageFilter <IMAGETYPE>ConnectorType;<BR>> typedef itk::ImageFileWriter <IMAGETYPE>WriterType;<BR>> <BR>> ReaderType::Pointer reader = ReaderType::New();<BR>> ConnectorType::Pointer connector = ConnectorType::New();<BR>> WriterType::Pointer writer = WriterType::New();<BR>> <BR>> reader->SetFileName( "D:circle.png");<BR>> connector->SetInput( reader->GetOutput() );<BR>> <BR>> vtkImageViewer * viewer = vtkImageViewer::New();<BR>> <BR>> vtkRenderWindowInteractor * renderWindowInteractor =<BR>> vtkRenderWindowInteractor::New();<BR>> <BR>> viewer->SetInput( connector->GetOutput() );<BR>> <BR>> viewer->SetColorWindow( 255 );<BR>> viewer->SetColorLevel( 128 );<BR>> viewer->SetupInteractor( renderWindowInteractor );<BR>> <BR>> viewer->Render();<BR>> renderWindowInteractor->Start();<BR>> <BR>> return 0;<BR>> }<BR>> <BR>> J.
Li<BR>> <BR>> ------------------------------------------------------------------------<BR>> Do you Yahoo!?<BR>> Yahoo! Small Business $15K Web Design Giveaway <BR>> <HTTP: evt="23609/*http://promotions.yahoo.com/design_giveaway/static/index2.html" us.rd.yahoo.com><BR>> - 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--