<DIV id=RTEContent>  <DIV id=RTEContent><PRE>hi All<BR>I'm developping an application that reads the first serie of<BR>Dicom images from a directory, show each image and save it<BR>in bmp format.<BR>the problem is that image series is well readed, and image<BR>  are well saved in bmp format, but image are not well showed<BR>in the vtkrenderwindow used ( i get a black window with two<BR>white line on it and not the image readed).<BR>this code in the main file :<BR><BR>this function is for reading first series from a given   <BR>directory and showing it's first dicom image(invoked by <BR>pushing the Read Directory button in the GUI)<BR>void<BR>migAppBase<BR>::ReadImage()<BR>{<BR>  // Can only read an image once<BR>  if(m_InputImage.IsNotNull())  <BR>   return;<BR>  <BR>  char* chooserName = fl_dir_chooser("select a dicom directory", 0, 0);<BR><BR>  // Store the filename<BR>  strcpy( m_InputImageDirectoryname, chooserName );<BR>  reader = ReaderType::New();  <BR>  dicomIO =
 ImageIOType::New();<BR>  nameGenerator = NamesGeneratorType::New();<BR>  reader-&gt;SetImageIO( dicomIO );<BR>  nameGenerator-&gt;SetUseSeriesDetails( true );<BR>  nameGenerator-&gt;SetDirectory( m_InputImageDirectoryname );  <BR>  seriesUID = nameGenerator-&gt;GetSeriesUIDs();<BR>    <BR>  seriesIdentifier = seriesUID.begin()-&gt;c_str();<BR>     <BR>  fileNames = nameGenerator-&gt;GetFileNames( seriesIdentifier );<BR><BR>  FileNamesItr = fileNames.begin  ();<BR>  FileNamesEnd = fileNames.end();<BR>    <BR>    <BR>  rescaler = RescaleFilterType::New();<BR>  rescaler-&gt;SetOutputMinimum(   0 );<BR>  rescaler-&gt;SetOutputMaximum( 255 );<BR>  reader-&gt;SetFileName( FileNamesItr-&gt;c_str() );  <BR><BR>  try<BR>      {<BR>    rescaler-&gt;SetInput( reader-&gt;GetOutput() );<BR>    reader-&gt;Update();<BR>    m_InputImage = reader-&gt;GetOutput();<BR>    m_InputImage-&gt;SetRequestedRegionToLargestPossibleRegion();  <BR>    <BR>    // Create the input image VTK pipeline<BR>   
 this-&gt;CreateInputImageWindow();<BR><BR>  }<BR>    catch (itk::ExceptionObject &amp;ex)<BR>      {<BR>      }<BR><BR>  FileNamesItr++;<BR>}<BR><BR>this function is for reading the next image in the serie  <BR>(invoked by pushing the Read Next button in the GUI)<BR><BR> void<BR>migAppBase<BR>::ReadNext()<BR>{<BR><BR><BR>if ( FileNamesItr != FileNamesEnd )<BR>{<BR><BR>reader-&gt;SetFileName( FileNamesItr-&gt;c_str() );<BR><BR>    try<BR>      {<BR>    rescaler-&gt;SetInput( reader-&gt;GetOutput() );<BR>    m_InputImage = reader-&gt;GetOutput();<BR>    m_InputImage-&gt;SetRequestedRegionToLargestPossibleRegion();<BR>    reader-&gt;Update();<BR>    // Create the input image VTK pipeline  <BR>    this-&gt;CreateInputImageWindow();<BR><BR>      }<BR>    catch (itk::ExceptionObject &amp;ex)<BR>      {<BR>      }<BR>FileNamesItr++;<BR>}<BR>}<BR><BR>this function is for saving the actual image (that should<BR>  be showed in the vtk window) in bmp format (invoked by <BR>pushing the save
 Image in the GUI)<BR><BR> void<BR>migAppBase<BR>::SaveImage()<BR>{<BR><BR>Writer2Type::Pointer writer2 = Writer2Type::New();<BR><BR>std::string OutputFilename1 = FileNamesItr-&gt;c_str() + std::string(".bmp");  <BR>writer2-&gt;SetFileName( OutputFilename1.c_str() );<BR>writer2-&gt;SetInput( rescaler-&gt;GetOutput() );<BR><BR>  try<BR>    {<BR>    writer2-&gt;Update();<BR>    }<BR>  catch (itk::ExceptionObject &amp; e)<BR>    {<BR>      }<BR><BR>}<BR><BR>this is the fuction for showing the actual image<BR><BR>void<BR>migAppBase<BR>::CreateInputImageWindow()<BR>{<BR>  // If this is the first time we've hit Image Suivante there's other stuff<BR>  // that needs to happen  <BR>  if(m_IsFirstUpdate)<BR>  {<BR>    // Display the output image<BR>    CreateWindowWithRWI(m_InputInteractor, m_InputWindow, "Input Image");<BR><BR>  // these two steps are VERY IMPORTANT, you have to show() the fltk window  <BR>  // containing the vtkFlRenderWindowInteractor, and then the<BR>  //
 vtkFlRenderWindowInteractor itself<BR>  m_InputWindow-&gt;show();<BR>  m_InputInteractor-&gt;show();<BR>   <BR>  // now we get to setup our VTK rendering pipeline  <BR>  CreateInputImageVTKPipeline(m_InputInteractor);<BR><BR>    // No longer the first update<BR>    m_IsFirstUpdate = false;<BR>  }<BR>  else<BR>  {<BR>    // Refresh the output window if not the first update<BR>    // NB: doing this on the first update on Windows causes a new  <BR>    // renderwindow to spawn (not sure why)<BR>   m_InputRenderWindow-&gt;Render();<BR>  }<BR>  <BR>}<BR><BR>function(s) for fltk and vtk interaction( creation of the<BR>vtkrenderwindow and integrating it to the fltk window)   <BR><BR>void<BR>migAppBase<BR>::CreateWindowWithRWI(vtkFlRenderWindowInteractor *&amp;flrwi, Fl_Window *&amp;flw, char *title)<BR>{<BR>   // set up main FLTK window<BR>   flw = new Fl_Window(300,330,title);<BR>   <BR>   // and instantiate vtkFlRenderWindowInteractor (here it acts like a  <BR>   // FLTK window, i.e. you
 could also instantiate it as child of a<BR>   // Fl_Group in a window)<BR>   flrwi = new vtkFlRenderWindowInteractor(5,5,290,260,NULL);<BR><BR>   // this will result in a little message under the rendering  <BR>   Fl_Box* box = new Fl_Box(5,261,290,34,<BR>                             "3 = stereo, j = joystick, t = trackball, "<BR>                            "w = wireframe, s = surface, p = pick; "<BR>                            "you can also resize the window");  <BR>   box-&gt;labelsize(10);<BR>   box-&gt;align(FL_ALIGN_WRAP);<BR>   <BR>   // we're done populating the flw<BR>   flw-&gt;end();<BR><BR>   // if the main window gets resized, the vtk window should resize with it<BR>   flw-&gt;resizable(flrwi);  <BR>}<BR><BR>void<BR>migAppBase<BR>::CreateInputImageVTKPipeline(vtkFlRenderWindowInteractor *flrwi)<BR>{<BR>  // Abort if the user is being stupid<BR>  if(m_InputImage.IsNull()) <BR>    return;<BR><BR>  // create a rendering window and renderer  <BR>  m_InputRenderer =
 vtkRenderer::New();<BR>  m_InputRenderer-&gt;SetBackground(0.0, 0.0, 0.0);<BR>  <BR>  m_InputRenderWindow = vtkRenderWindow::New();<BR>  m_InputRenderWindow-&gt;AddRenderer(m_InputRenderer);<BR>     <BR>  // NB: here we treat the vtkFlRenderWindowInteractor just like any other<BR>  // old vtkRenderWindowInteractor<BR>  flrwi-&gt;SetRenderWindow(m_InputRenderWindow);<BR><BR>  // Hook the VTK pipeline up to the ITK pipeline  <BR>  m_InputImageITKtoVTKexporter = itk::VTKImageExport&lt;InputImageType&gt;::New();<BR>  m_InputImageVTKimporter = vtkImageImport::New();<BR>  m_InputImageITKtoVTKexporter-&gt;SetInput( m_InputImage );<BR>  ConnectPipelines(m_InputImageITKtoVTKexporter, m_InputImageVTKimporter);  <BR><BR>  // Need to update prior to creating the cutting planes<BR>  m_InputImageITKtoVTKexporter-&gt;Update();<BR>  m_InputImageVTKimporter-&gt;Update();<BR><BR>  // Create the image cutting planes<BR>  m_InputImagePlaneX = vtkImagePlaneWidget::New();  <BR> 
 m_InputImagePlaneX-&gt;RestrictPlaneToVolumeOn();<BR>  m_InputImagePlaneX-&gt;SetResliceInterpolateToCubic();<BR>  m_InputImagePlaneX-&gt;SetInput( (vtkDataSet*) m_InputImageVTKimporter-&gt;GetOutput() );<BR>  m_InputImagePlaneX-&gt;SetPlaneOrientationToXAxes();  <BR>  m_InputImagePlaneX-&gt;SetSliceIndex( 0 );<BR>  <BR>  m_InputImagePlaneY = vtkImagePlaneWidget::New();<BR>  m_InputImagePlaneY-&gt;RestrictPlaneToVolumeOn();<BR>  m_InputImagePlaneY-&gt;SetResliceInterpolateToCubic();  <BR>  m_InputImagePlaneY-&gt;SetInput( (vtkDataSet*) m_InputImageVTKimporter-&gt;GetOutput() );<BR>  m_InputImagePlaneY-&gt;SetPlaneOrientationToYAxes();<BR>  m_InputImagePlaneY-&gt;SetSliceIndex( 0 );<BR>  // Set the position of the image planes to the center of the volume  <BR>  this-&gt;ResetInputImagePlaneWidgets();<BR><BR>  // Link the image planes to the interactor<BR>  m_InputImagePlaneX-&gt;SetInteractor( flrwi );<BR>  m_InputImagePlaneY-&gt;SetInteractor( flrwi );<BR><BR>  // Turn on the image
 plane so they display  <BR>  m_InputImagePlaneX-&gt;On();<BR>  m_InputImagePlaneY-&gt;On();<BR><BR>  // just like with any other vtkRenderWindowInteractor(), you HAVE to call<BR>  // Initialize() before the interactor will function.  See the docs in  <BR>  // vtkRenderWindowInteractor.h<BR>  // This must occur AFTER the image planes have been added to the interactor<BR>  flrwi-&gt;Initialize();<BR><BR>  // Clean up memory allocation (NB: not actually deleted until program returns)  <BR>  m_InputRenderer-&gt;Delete();<BR>  m_InputRenderWindow-&gt;Delete();<BR>}<BR><BR>thx for help<BR>any comment is welcome<BR>Amir</PRE></DIV></DIV><p>
                <hr size=1> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
<a href="http://us.rd.yahoo.com/messenger/mail_taglines/default/*http://fr.beta.messenger.yahoo.com">Téléchargez</a> la version beta.