<!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&nbsp;&nbsp;&nbsp; Retry&nbsp;&nbsp;&nbsp; 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>

&nbsp;&nbsp;&nbsp; typedef itk::Image &lt;unsigned char,2&gt; ImageType;&nbsp;&nbsp; //short<br>

&nbsp;&nbsp;&nbsp; typedef itk::ImageFileReader &lt;ImageType&gt; ReaderType;<br>

&nbsp;&nbsp;&nbsp; typedef itk::ImageToVTKImageFilter &lt;ImageType&gt; ConnectorType;<br>

<br>

&nbsp;&nbsp;&nbsp; ReaderType::Pointer reader = ReaderType::New();<br>

&nbsp;&nbsp;&nbsp; ConnectorType::Pointer connector = ConnectorType::New();<br>

<br>

&nbsp;&nbsp;&nbsp; reader-&gt;SetFileName ( "argv[1]" );&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //or ("C:BrainT1Slice.png");<br>

&nbsp;&nbsp;&nbsp; connector-&gt;SetInput ( reader-&gt;GetOutput() );<br>

<br>

&nbsp;&nbsp;&nbsp; vtkImageViewer* viewer= vtkImageViewer::New();<br>

&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor* renderWindowInteractor=&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor::New();<br>

<br>

&nbsp;&nbsp;&nbsp; viewer-&gt;SetInput ( connector-&gt;GetOutput() );<br>

&nbsp;&nbsp;&nbsp; viewer-&gt;Render();<br>

&nbsp;&nbsp;&nbsp; viewer-&gt;SetColorWindow ( 255);<br>

&nbsp;&nbsp;&nbsp; viewer-&gt;SetColorLevel ( 128);<br>

&nbsp;&nbsp;&nbsp; viewer-&gt;SetupInteractor (renderWindowInteractor);<br>

<br>

&nbsp;&nbsp;&nbsp; renderWindowInteractor-&gt;Start();<br>

<br>

&nbsp;&nbsp;&nbsp; return 0;<br>

}</body></html>