<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=iso-8859-7>
<META content="MSHTML 6.00.6000.16608" name=GENERATOR></HEAD>
<BODY id=MailContainerBody
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px"
bgColor=#ffffff leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have combined the code found in
itkReadITKImageShowVTK.cpp file (InsightApplications\Auxiliary\vtk) and the code
found in DicomSeriesReadImageWrite2.cpp (InsightToolkit\Examples\IO) to read a
DICOM series and visualize it in VTK. My problem is that the volume is not
visualized. Here is my code. </FONT><FONT face=Arial size=2></FONT></DIV>
<DIV><FONT color=#0000ff size=2>
<P>template</FONT><FONT size=2> <</FONT><FONT color=#0000ff
size=2>typename</FONT><FONT size=2> ITK_Exporter, </FONT><FONT color=#0000ff
size=2>typename</FONT><FONT size=2> VTK_Importer></P></FONT><FONT
color=#0000ff size=2>
<P>void</FONT><FONT size=2> ConnectPipelines(ITK_Exporter exporter,
VTK_Importer* importer)</P>
<P>{</P>
<P>importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());</P>
<P>importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());</P>
<P>importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());</P>
<P>importer->SetSpacingCallback(exporter->GetSpacingCallback());</P>
<P>importer->SetOriginCallback(exporter->GetOriginCallback());</P>
<P>importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());</P>
<P>importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());</P>
<P>importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());</P>
<P>importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());</P>
<P>importer->SetDataExtentCallback(exporter->GetDataExtentCallback());</P>
<P>importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());</P>
<P>importer->SetCallbackUserData(exporter->GetCallbackUserData());</P>
<P>}</P></FONT><FONT color=#0000ff size=2>
<P>int</FONT><FONT size=2> itkReadDicomSeries (std::string directoryPath)</P>
<P>{ </P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>signed</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>short</FONT><FONT size=2> PixelType;</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT
color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff
size=2>int</FONT><FONT size=2> Dimension = 3;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2>
itk::OrientedImage< PixelType, Dimension > ImageType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2>
itk::ImageSeriesReader< ImageType > ReaderType;</P>
<P>ReaderType::Pointer reader = ReaderType::New();</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2>
itk::GDCMImageIO ImageIOType;</P>
<P>ImageIOType::Pointer dicomIO = ImageIOType::New();</P>
<P>reader->SetImageIO( dicomIO );</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2>
itk::GDCMSeriesFileNames NamesGeneratorType;</P>
<P>NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();</P>
<P>nameGenerator->SetUseSeriesDetails( </FONT><FONT color=#0000ff
size=2>true</FONT><FONT size=2> );</P>
<P>nameGenerator->AddSeriesRestriction(</FONT><FONT color=#800000
size=2>"0008|0021"</FONT><FONT size=2> );</P>
<P>nameGenerator->SetDirectory(directoryPath);</P>
<P></P>
<P>std::cout << std::endl << </FONT><FONT color=#800000 size=2>"The
directory: "</FONT><FONT size=2> << std::endl;</P>
<P>std::cout << std::endl << directoryPath << std::endl
<< std::endl;</P>
<P>std::cout << </FONT><FONT color=#800000 size=2>"Contains the following
DICOM Series: "</FONT><FONT size=2>;</P>
<P>std::cout << std::endl << std::endl;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> std::vector<
std::string > SeriesIdContainer;</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> SeriesIdContainer
& seriesUID = nameGenerator->GetSeriesUIDs();</P>
<P>SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();</P>
<P>SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();</P>
<P></FONT><FONT color=#0000ff size=2>while</FONT><FONT size=2>( seriesItr !=
seriesEnd ) {</P>
<P>std::cout << seriesItr->c_str() << std::endl;</P>
<P>seriesItr++;</P>
<P>}</P>
<P>std::string seriesIdentifier;</P>
<P>seriesIdentifier = seriesUID.begin()->c_str();</P>
<P></P>
<P>std::cout << std::endl << std::endl;</P>
<P>std::cout << </FONT><FONT color=#800000 size=2>"Now reading series:
"</FONT><FONT size=2> << std::endl << std::endl;</P>
<P>std::cout << seriesIdentifier << std::endl;</P>
<P>std::cout << std::endl << std::endl;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> std::vector<
std::string > FileNamesContainer;</P>
<P>FileNamesContainer fileNames;</P>
<P>fileNames = nameGenerator->GetFileNames( seriesIdentifier );</P>
<P>reader->SetFileNames( fileNames ); </P>
<P>reader->Update();</P>
<P></P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2>
itk::VTKImageExport< ImageType > ExportFilterType;</P>
<P>ExportFilterType::Pointer itkExporter = ExportFilterType::New();</P>
<P>itkExporter->SetInput( reader->GetOutput() );</P>
<P></FONT><FONT color=#008000 size=2>// Create the vtkImageImport and connect it
to the </FONT><FONT color=#008000 size=2>itk::VTKImageExport
instance.</P></FONT><FONT size=2>
<P>vtkImageImport* vtkImporter = vtkImageImport::New(); </P>
<P>ConnectPipelines(itkExporter, vtkImporter);</P>
<P></P>
<P> </P>
<P>vtkPiecewiseFunction* opacityTransferFunction =
vtkPiecewiseFunction::New();</P>
<P></P>
<P>vtkVolume* volume = vtkVolume::New();</P>
<P>vtkVolumeProperty* volumeProperty = vtkVolumeProperty::New(); </P>
<P>vtkVolumeTextureMapper3D* volumeMapper = vtkVolumeTextureMapper3D::New();</P>
<P>vtkFixedPointVolumeRayCastMapper* volumeMapperSoftware =
vtkFixedPointVolumeRayCastMapper::New();</P>
<P></P>
<P></FONT><FONT color=#008000 size=2> </P></FONT><FONT size=2>
<P>volumeProperty->SetScalarOpacity(opacityTransferFunction);</P>
<P>volumeProperty->SetInterpolationTypeToLinear();</P>
<P>volumeProperty->ShadeOff();</P>
<P>volume->SetProperty(volumeProperty);</P>
<P>volumeMapperSoftware->SetInput(vtkImporter->GetOutput());</P>
<P>volumeMapperSoftware->SetSampleDistance(1.0);</P>
<P>volumeMapperSoftware->SetBlendModeToMaximumIntensity();</P>
<P>volume->SetMapper(volumeMapperSoftware);</P>
<P></P>
<P>vtkInteractorStyleTrackballCamera * interactorStyle =
vtkInteractorStyleTrackballCamera::New();</P>
<P></FONT><FONT color=#008000 size=2>// Create a renderer, render window, and
render window interactor to</FONT><FONT color=#008000 size=2> display the
results.</P></FONT><FONT size=2>
<P>vtkRenderer* renderer = vtkRenderer::New();</P>
<P>vtkRenderWindow* renWin = vtkRenderWindow::New();</P>
<P>vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();</P>
<P></P>
<P>renWin->SetSize(500, 500);</P>
<P>renWin->AddRenderer(renderer);</P>
<P>iren->SetRenderWindow(renWin);</P>
<P>iren->SetInteractorStyle(interactorStyle);</P>
<P></P>
<P></FONT><FONT color=#008000 size=2></FONT> </P>
<P><FONT color=#008000 size=2>// Add the vtkImageActor to the renderer for
display.</P></FONT><FONT size=2>
<P>renderer->AddVolume(volume);</P>
<P>renderer->SetBackground(0.4392, 0.5020, 0.5647);</P>
<P></FONT><FONT color=#008000 size=2></FONT> </P>
<P><FONT color=#008000 size=2>// Bring up the render window and begin
interaction.</P></FONT><FONT size=2>
<P>renWin->Render();</P>
<P>iren->Start();</P>
<P>}</P>
<P><FONT face=Arial>I would really appreciate any help. Thanks in
advance.</FONT></P></FONT></DIV></BODY></HTML>