<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:"times new roman", "new york", "times", serif;font-size:12pt"><DIV><DIV>Hello, </DIV><DIV><BR>Okay, I have tried it with vtkContourFilter and it works, but still takes cropping problem. How can I be sure or determine the spatial coordinates that correct? What function in vtk should I use for cropping of the 3D-image? I think the problem lies not in the direction of the camera., but read with the pictures. Please help.<BR></DIV><DIV><BR>Thank you!<BR></DIV><DIV><BR></DIV><DIV><BR>typedef itk::OrientedImage< InputPixelType, Dimension > ImageType;<BR> typedef itk::ImageSeriesReader< ImageType > ReaderType;<BR> ReaderType::Pointer reader = ReaderType::New();<BR><BR> typedef itk::GDCMImageIO ImageIOType;<BR> ImageIOType::Pointer dicomIO = ImageIOType::New();<BR> <BR> reader->SetImageIO( dicomIO );<BR><BR> typedef
itk::GDCMSeriesFileNames NamesGeneratorType;<BR> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<BR><BR> nameGenerator->SetUseSeriesDetails( true );<BR>nameGenerator->AddSeriesRestriction("0008|0021" );<BR> nameGenerator->SetDirectory( selectedDirectory);<BR><BR> typedef std::vector< std::string > SeriesIdContainer;<BR> <BR> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();<BR> <BR> SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<BR> SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<BR> while( seriesItr != seriesEnd )<BR> {<BR> seriesItr++;<BR>Â }<BR>Â std::string seriesIdentifier;<BR> seriesIdentifier = seriesUID.begin()->c_str();<BR><BR> typedef std::vector< std::string > FileNamesContainer;<BR>Â FileNamesContainer fileNames;<BR>Â fileNames = nameGenerator->GetFileNames( seriesIdentifier );</DIV><DIV><BR>
reader->SetFileNames( fileNames );<BR> reader->Update();<BR><BR> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;<BR> typedef itk::Image<OutputPixelType, Dimension> OutputImageType;<BR> <BR> typedef itk::ConfidenceConnectedImageFilter<InternalImageType, OutputImageType> ConnectedFilterType;<BR> ConnectedFilterType::Pointer confidenceConnected = ConnectedFilterType::New();<BR> <BR>confidenceConnected->SetInput(reader->GetOutput());<BR>confidenceConnected->SetMultiplier(2.5);<BR> confidenceConnected->SetNumberOfIterations(2);<BR> confidenceConnected->SetReplaceValue(255);<BR><BR> InternalImageType::IndexType index;<BR> index[0] = (int)this->changeRegionGrowingInputX->value();<BR> index[1] = (int)this->changeRegionGrowingInputY->value();<BR> index[2] = (int)this->changeRegionGrowingInputZ->value();<BR> confidenceConnected->AddSeed( index );<BR> <BR> typedef
itk::VTKImageExport< InternalImageType > ExportFilter1Type;<BR> typedef itk::VTKImageExport< OutputImageType > ExportFilter2Type;<BR><BR> ExportFilter1Type::Pointer itkExporter1 = ExportFilter1Type::New();<BR> ExportFilter2Type::Pointer itkExporter2 = ExportFilter2Type::New();<BR> <BR> itkExporter1->SetInput( reader->GetOutput() );<BR> itkExporter2->SetInput( confidenceConnected->GetOutput() );<BR> <BR> vtkImageImport* vtkImporter1 = vtkImageImport::New(); <BR> ConnectPipelines(itkExporter1, vtkImporter1);<BR> <BR> vtkImageImport* vtkImporter2 = vtkImageImport::New(); <BR>ConnectPipelines(itkExporter2, vtkImporter2);<BR> vtkImporter1->Update();<BR> <BR> mode3D = vtkInteractorStyleTrackballCamera::New();<BR><BR> renderer3D = vtkRenderer::New();<BR><BR> renderWindow3D = vtkRenderWindow::New();<BR> renderWindow3D->AddRenderer(renderer3D);<BR><BR>
displayImage3D->SetRenderWindow(renderWindow3D);<BR> displayImage3D->SetInteractorStyle(mode3D);<BR> displayImage3D->Initialize();<BR><BR>contour = vtkContourFilter::New();<BR> contour->SetInput( vtkImporter2->GetOutput() );<BR> contour->ComputeNormalsOn();<BR> contour->ComputeGradientsOn();<BR> contour->ComputeScalarsOn();<BR> contour->SetNumberOfContours(2);<BR>contour->SetValue(0, 255);Â <BR><BR> polyMapper = vtkPolyDataMapper::New();</DIV><DIV>polyMapper->SetInput(contour->GetOutput());<BR> polyMapper->ScalarVisibilityOff();</DIV><DIV><BR>polyActor = vtkActor::New();<BR> polyActor->SetMapper(polyMapper);<BR>Â <BR> propertyRegionGrowing = vtkProperty::New();<BR> propertyRegionGrowing->SetAmbient(0.3);<BR> propertyRegionGrowing->SetDiffuse(1.0);<BR> propertyRegionGrowing->SetSpecular(0.2);<BR>
propertyRegionGrowing->SetSpecularPower(10.0);<BR>propertyRegionGrowing->SetColor(1, 1, 1);<BR> propertyRegionGrowing->SetRepresentationToSurface();<BR> polyActor->SetProperty(propertyRegionGrowing);<BR> <BR> camera3D = vtkCamera::New();<BR> camera3D->SetViewUp(0, 0, -1);<BR> camera3D->SetPosition(0, 1, 0);<BR> camera3D->SetFocalPoint(0, 0, 0);<BR> camera3D->ComputeViewPlaneNormal();<BR> camera3D->Azimuth(20);<BR></DIV><DIV><BR></DIV><DIV>renderer3D->AddActor(polyActor);<BR> renderer3D->SetActiveCamera(camera3D);<BR> renderer3D->ResetCamera();<BR> camera3D->Dolly(1.3);<BR> renderer3D->ResetCameraClippingRange();<BR> </DIV><DIV><BR></DIV><BR><DIV style="font-family:arial, helvetica, sans-serif;font-size:10pt"><FONT size="2" face="Tahoma"><HR size="1"><B><SPAN style="font-weight: bold;">Von:</SPAN></B> Luis Ibanez <luis.ibanez@kitware.com><BR><B><SPAN style="font-weight:
bold;">An:</SPAN></B> Yusuf OEZBEK <nasil122002@yahoo.de><BR><B><SPAN style="font-weight: bold;">CC:</SPAN></B> ITK Mailinglist <insight-users@itk.org>; VTK Mailinglist <vtkusers@vtk.org>; nasil122002@gmail.com<BR><B><SPAN style="font-weight: bold;">Gesendet:</SPAN></B> Dienstag, den 30. März 2010, 0:48:58 Uhr<BR><B><SPAN style="font-weight: bold;">Betreff:</SPAN></B> Re: [vtkusers] Region Growing (Volume Rendering) Cropping Problem<BR></FONT><BR>Hi Yusuf,<BR><BR>The output of the Region Growing filters in ITK are binary images.<BR><BR>The fist thing you should do is to make sure that your camera is<BR>looking in the right direction.<BR><BR>To this end, you could simply introduce first a surface-based visualization<BR>of the binary image, by passing it through the vtkContour filter, as illustrated<BR>in the examples :<BR><BR>     InsightApplications/Auxiliary/vtk/<BR>         Â
itkReadITKImage3DExtractContourVTK.cxx<BR>Â Â Â Â Â Â Â Â Â Â ExtractIsoSurface.cxx<BR>Â Â Â Â Â Â Â Â Â Â ScreenShotGenerator.cxx<BR><BR><A href="http://public.kitware.com/cgi-bin/viewcvs.cgi/Auxiliary/vtk/?root=InsightApplications" target="_blank">http://public.kitware.com/cgi-bin/viewcvs.cgi/Auxiliary/vtk/?root=InsightApplications</A><BR><BR><BR>Once you have made sure that your spatial coordinates are correct,<BR>you could proceed to setup a volume rendering visualization.<BR><BR>You should then make sure that you use a transfer function suitable<BR>for an image whose pixel values are only { 0, 255 }. The transfer<BR>function that you may have used for the original values of the DICOM<BR>image, will probably not be appropriate for the binary values of the<BR>segmented image.<BR><BR><BR>Also, please note that Volume Rendering (although it is an extremly<BR>useful visualization method) is not a substitute for image
segmentation<BR>methods.<BR><BR><BR><BR>  Regards,<BR><BR><BR>    Luis<BR></DIV><DIV style="font-family:arial, helvetica, sans-serif;font-size:10pt"><BR></DIV><DIV style="font-family:arial, helvetica, sans-serif;font-size:10pt"><BR></DIV><DIV style="font-family:arial, helvetica, sans-serif;font-size:10pt"><BR>-----------------------------------------------------------------------------------------------<BR>On Mon, Mar 29, 2010 at 6:10 AM, Yusuf OEZBEK <<A ymailto="mailto:nasil122002@yahoo.de" href="mailto:nasil122002@yahoo.de">nasil122002@yahoo.de</A>> wrote:<BR>> Hello All.<BR>><BR>> I have a problem with to cut (cropping) a 3D object, which I produced by the<BR>> segmentation-method “region growingâ€. In the beginning I read the DICOM (.<BR>> dcm) images with itkImageSeriesReader then I run region growing -algorithm,<BR>> in order to connect itk with vtk and a 3D object produce, I use<BR>>
ImageToVTKImageFilter and volume rendering (ray casting). And after<BR>> segmentation of cutting the images I give below<BR>> vtkFixedPointVolumeRayCastMapper (SetCroppingRegionPlanes) the Xmin, Xmax,<BR>> Ymin, Ymax, Zmin and Zmax coordinates, but the result is a black screen. But<BR>> when I read the images with vtkDICOMImageReader and then segmented with<BR>> volume rendering, then it works completely well. The problem arises only for<BR>> region growing -algorithm. Where is my mistake in the code? What should I<BR>> do?<BR>><BR>> Thank you.<BR>><BR>><BR>></DIV><BR></DIV><DIV><BR></DIV>
</div><br>__________________________________________________<br>Do You Yahoo!?<br>Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. <br>http://mail.yahoo.com </body></html>