<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE></TITLE>
<STYLE>
body, table, tr, td, p {font-family: Verdana;font-size:12px;margin: 0px 0px 0px 0px}
.bgtabl {BACKGROUND-REPEAT: no-repeat}
</STYLE>
</HEAD>
<BODY bgProperties="fixed" bgcolor="#FFFFFF" background="http://flashimg.club-internet.fr/flashmail/Skins/Vacance2/vide.gif">
Hi!<br>
<br>
I'm new in the ITK community. So i began by getting started. <br>
I got a problem with the second lesson.<br>
I create the Cmakelists, no problem.<br>
I create the myproject.cxx, no problem.<br>
When I compile, no problem. I copied itkImageToVTKImageFilter.h, itkImageToVTKImageFilter.txx, itkVTKImageToImageFilter.h<i>, itkVTKImageToImageFilter.txx</i> in my source directory. <br>
I run the myproject.exe in a cmd window giving an image as argument.<br>
At run time, the program crashes. The following pop-up message appears:<br>
<br>
Debug error!<br>
Program : C:\...\myproject.exe<br>
Abnormal program termination<br>
Abandon Retry Ignore<br>
<br>
When i modify the source code, giving the file name in the
SetFileName() method, the program runs and display the requested image.<br>
<br>
Perhaps I give a false argument to the program, so it can't open the file...?<br>
<br>
Here the code used:<br>
<br>
#include "itkImage.h"<br>
#include "itkImageFileReader.h"<br>
#include "itkImageToVTKImageFilter.h"<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; //short<br>
typedef itk::ImageFileReader <ImageType> ReaderType;<br>
typedef itk::ImageToVTKImageFilter <ImageType> ConnectorType;<br>
<br>
ReaderType::Pointer reader = ReaderType::New();<br>
ConnectorType::Pointer connector = ConnectorType::New();<br>
<br>
reader->SetFileName ( "argv[1]" ); //or ("C:BrainT1Slice.png");<br>
connector->SetInput ( reader->GetOutput() );<br>
<br>
vtkImageViewer* viewer= vtkImageViewer::New();<br>
vtkRenderWindowInteractor* renderWindowInteractor= vtkRenderWindowInteractor::New();<br>
<br>
viewer->SetInput ( connector->GetOutput() );<br>
viewer->Render();<br>
viewer->SetColorWindow ( 255);<br>
viewer->SetColorLevel ( 128);<br>
viewer->SetupInteractor (renderWindowInteractor);<br>
<br>
renderWindowInteractor->Start();<br>
<br>
return 0;<br>
}</body></html>