<DIV>
<DIV>Hi:</DIV>
<DIV> I am a beginner.Now I do a CT series Image processing(DICOM).</DIV>
<DIV>Source codes as follow:</DIV>
<DIV>*************************************************************</DIV>
<DIV>#if defined(_MSC_VER)<BR>#pragma warning ( disable : 4786 )<BR>#endif</DIV>
<DIV>#ifdef __BORLANDC__<BR>#define ITK_LEAN_AND_MEAN<BR>#endif</DIV>
<DIV>// ITK include<BR>#include "itkBinaryThresholdImageFilter.h"<BR>#include "itkCannySegmentationLevelSetImageFilter.h"<BR>#include "itkCastImageFilter.h"<BR>#include "itkConfidenceConnectedImageFilter.h"<BR>#include "itkCurvatureAnisotropicDiffusionImageFilter.h"<BR>#include "itkFastMarchingImageFilter.h"<BR>#include "itkGDCMImageIO.h"<BR>#include "itkGDCMSeriesFileNames.h"<BR>#include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"<BR>#include "itkImageFileWriter.h"<BR>#include "itkImageSeriesReader.h"<BR>#include "itkImageToVTKImageFilter.h"<BR>#include "itkImportImageFilter.h"<BR>#include "itkIntensityWindowingImageFilter.h"<BR>#include "itkOrientedImage.h"<BR>#include "itkRescaleIntensityImageFilter.h"<BR>#include "itkSigmoidImageFilter.h"</DIV>
<DIV>// VTK include<BR>#include "vtkActor.h"<BR>#include "vtkBoxWidget.h"<BR>#include "vtkCamera.h"<BR>#include "vtkCommand.h"<BR>#include "vtkColorTransferFunction.h"<BR>#include "vtkContourFilter.h"<BR>#include "vtkDataSetMapper.h"<BR>#include "vtkDICOMImageReader.h"<BR>#include "vtkGeometryFilter.h"<BR>#include "vtkGPUVolumeRayCastMapper.h"<BR>#include "vtkImageData.h"<BR>#include "vtkImageResample.h"<BR>#include "vtkImageViewer.h"<BR>#include "vtkMetaImageReader.h"<BR>#include "vtkPiecewiseFunction.h"<BR>#include "vtkPlanes.h"<BR>#include "vtkPolyData.h"<BR>#include "vtkPolyDataMapper.h"<BR>#include "vtkProperty.h"<BR>#include "vtkRenderer.h"<BR>#include "vtkRenderWindow.h"<BR>#include "vtkRenderWindowInteractor.h"<BR>#include "vtkVolume.h"<BR>#include "vtkVolumeProperty.h"<BR>#include "vtkXMLImageDataReader.h"</DIV>
<DIV>//#include "vvITKFilterModuleBase.h"<BR>//#include "vtkVVPluginAPI.h"<BR>//#include "vvITKCannySegmentationLevelSetModule.cxx"</DIV>
<DIV>#define VTI_FILETYPE 1<BR>#define MHA_FILETYPE 2</DIV>
<DIV>class vtkBoxWidgetCallback : public vtkCommand<BR>{<BR>public:<BR> static vtkBoxWidgetCallback *New()<BR> { <BR> return new vtkBoxWidgetCallback; <BR> }<BR> <BR> virtual void Execute(vtkObject *caller, unsigned long, void*)<BR> {<BR> vtkBoxWidget *widget = reinterpret_cast<vtkBoxWidget*>(caller);<BR> if (this->Mapper)<BR> {<BR> vtkPlanes *planes = vtkPlanes::New();<BR> widget->GetPlanes(planes);<BR> this->Mapper->SetClippingPlanes(planes);<BR> planes->Delete();<BR> }<BR> }<BR> <BR> void SetMapper(vtkGPUVolumeRayCastMapper* m) <BR> { <BR> this->Mapper = m; <BR> }</DIV>
<DIV>protected:<BR> vtkBoxWidgetCallback() <BR> { <BR> this->Mapper = 0; <BR> }</DIV>
<DIV> vtkGPUVolumeRayCastMapper *Mapper;<BR>};</DIV>
<DIV>int main(int argc, char *argv[])<BR>{<BR> // reader and connector<BR> typedef signed short PixelType;<BR> const unsigned int Dimension = 3;<BR> typedef itk::OrientedImage< PixelType, Dimension > ImageType;<BR> typedef itk::ImageSeriesReader< ImageType > ReaderType;<BR> typedef itk::ImageToVTKImageFilter< ImageType > ConnectType;<BR> <BR> ReaderType::Pointer reader = ReaderType::New();<BR> ConnectType::Pointer connector = ConnectType::New();</DIV>
<DIV> // set reader to DICOM <BR> typedef itk::GDCMImageIO ImageIOType;<BR> ImageIOType::Pointer dicomIO = ImageIOType::New();<BR> reader->SetImageIO( dicomIO );</DIV>
<DIV> typedef itk::GDCMSeriesFileNames NamesGeneratorType;<BR> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();</DIV>
<DIV> nameGenerator->SetUseSeriesDetails( true );<BR> nameGenerator->AddSeriesRestriction( "0008|0021" );</DIV>
<DIV> nameGenerator->SetDirectory( "dicom4" );<BR> <BR>/* <BR> //typedef unsigned char MaskPixelType;<BR> typedef signed short MaskPixelType;<BR> typedef itk::OrientedImage< MaskPixelType, Dimension > MaskImageType;<BR> typedef itk::ConfidenceConnectedImageFilter< ImageType, MaskImageType > SegmentationFilterType;<BR> SegmentationFilterType::Pointer filter = SegmentationFilterType::New(); <BR>*/ <BR> try<BR> {<BR> std::cout << std::endl << "The directory: " << std::endl;<BR> std::cout << std::endl << "dicom4" << std::endl << std::endl;<BR> std::cout << "Contains the following DICOM Series: ";<BR> std::cout << std::endl << std::endl;</DIV>
<DIV> typedef std::vector< std::string > SeriesIdContainer; <BR> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs(); <BR> SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<BR> SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<BR> <BR> while( seriesItr != seriesEnd )<BR> {<BR> std::cout << seriesItr->c_str() << std::endl;<BR> seriesItr++;<BR> }</DIV>
<DIV> std::string seriesIdentifier;<BR> seriesIdentifier = seriesUID.begin()->c_str();</DIV>
<DIV> std::cout << std::endl << std::endl;<BR> std::cout << "Now reading series: " << std::endl << std::endl;<BR> std::cout << seriesIdentifier << std::endl;<BR> std::cout << std::endl << std::endl;</DIV>
<DIV> typedef std::vector< std::string > FileNamesContainer;<BR> FileNamesContainer fileNames;<BR> fileNames = nameGenerator->GetFileNames( seriesIdentifier ); <BR> reader->SetFileNames( fileNames );</DIV>
<DIV> try<BR> {<BR> reader->Update();<BR> }<BR> catch (itk::ExceptionObject &ex)<BR> {<BR> std::cout << ex << std::endl;<BR> return EXIT_FAILURE;<BR> }<BR> <BR>////////////////////////////////////////////////////////////</DIV>
<DIV>/* filter->SetInput( reader->GetOutput() );<BR> filter->SetNumberOfIterations(0);<BR> filter->SetReplaceValue(255);<BR> filter->SetMultiplier(2.5);<BR> ImageType::IndexType seed;<BR> seed[0]=50;<BR> seed[1]=50;<BR> seed[2]=50;<BR> filter->SetSeed(seed); */<BR> //filter->Update();<BR> <BR> // Fast Marching started...<BR> typedef float RealPixelType;<BR> typedef itk::OrientedImage< RealPixelType,3 > RealImageType;<BR> typedef unsigned char OutputPixelType;<BR> typedef itk::OrientedImage< OutputPixelType, 3 > OutputImageType;</DIV>
<DIV> typedef itk::BinaryThresholdImageFilter< RealImageType, RealImageType> ThresholdingFilterType;<BR> ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();</DIV>
<DIV> const PixelType timeThreshold = 130;<BR> <BR> // Threshold setting<BR> thresholder->SetLowerThreshold( 0.0 );<BR> thresholder->SetUpperThreshold( timeThreshold );</DIV>
<DIV> // Value setting<BR> thresholder->SetOutsideValue( 0 );<BR> thresholder->SetInsideValue( 255 );</DIV>
<DIV> typedef itk::ImageFileReader< ImageType > ReaderType;<BR> typedef itk::ImageFileWriter< OutputImageType > WriterType;<BR> typedef itk::RescaleIntensityImageFilter< <BR> ImageType, <BR> OutputImageType > CastFilterType;<BR> typedef itk::CurvatureAnisotropicDiffusionImageFilter< <BR> RealImageType, <BR> RealImageType > SmoothingFilterType; <BR> SmoothingFilterType::Pointer smoothing = SmoothingFilterType::New();</DIV>
<DIV> typedef itk::GradientMagnitudeRecursiveGaussianImageFilter< <BR> RealImageType, <BR> RealImageType > GradientFilterType;<BR> typedef itk::SigmoidImageFilter< RealImageType, <BR> RealImageType > SigmoidFilterType;</DIV>
<DIV> GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New();<BR> SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New();</DIV>
<DIV> sigmoid->SetOutputMinimum( 0 );<BR> sigmoid->SetOutputMaximum( 1 );</DIV>
<DIV> typedef itk::FastMarchingImageFilter< RealImageType, <BR> RealImageType > FastMarchingFilterType;<BR> FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();</DIV>
<DIV> typedef itk::CastImageFilter< ImageType,RealImageType> Image_to_Real_Type;<BR> Image_to_Real_Type::Pointer image_to_real_Filter = Image_to_Real_Type::New();</DIV>
<DIV> image_to_real_Filter->SetInput(reader->GetOutput() );<BR> smoothing->SetInput( image_to_real_Filter->GetOutput());<BR> //real_to_image_Filter->SetInput(smoothing->GetOutput());<BR> gradientMagnitude->SetInput( smoothing->GetOutput() );<BR> sigmoid->SetInput( gradientMagnitude->GetOutput() );<BR> fastMarching->SetInput( sigmoid->GetOutput() );<BR> //fastMarching->SetInput( gradientMagnitude->GetOutput() );<BR> thresholder->SetInput( fastMarching->GetOutput() );</DIV>
<DIV> smoothing->SetTimeStep( 0.0625 );<BR> smoothing->SetNumberOfIterations( 3 );<BR> smoothing->SetConductanceParameter( 3 );</DIV>
<DIV> const double sigma = 3;</DIV>
<DIV> gradientMagnitude->SetSigma( sigma );</DIV>
<DIV> sigmoid->SetAlpha( 20 );<BR> sigmoid->SetBeta( 170 );</DIV>
<DIV> typedef FastMarchingFilterType::NodeContainer NodeContainer;<BR> typedef FastMarchingFilterType::NodeType NodeType;<BR> NodeContainer::Pointer seeds = NodeContainer::New();</DIV>
<DIV> ImageType::IndexType seedPosition;<BR> <BR> seedPosition[0] = 250;<BR> seedPosition[1] = 250;<BR> seedPosition[2] = 50;</DIV>
<DIV> NodeType node;<BR> const double seedValue = 0.0;<BR> <BR> node.SetValue( seedValue );<BR> node.SetIndex( seedPosition );</DIV>
<DIV> seeds->Initialize();<BR> seeds->InsertElement( 0, node );</DIV>
<DIV> fastMarching->SetTrialPoints( seeds );<BR> fastMarching->SetOutputSize( reader->GetOutput()->GetBufferedRegion().GetSize() );<BR> reader->Update();<BR> fastMarching->SetStoppingValue( 100 );<BR> </DIV>
<DIV> typedef itk::CastImageFilter< RealImageType,ImageType> Real_to_Image_Type;<BR> Real_to_Image_Type::Pointer real_to_image_Filter = Real_to_Image_Type::New();<BR> real_to_image_Filter->SetInput(fastMarching->GetOutput());<BR> //connector->SetInput(real_to_image_Filter->GetOutput());<BR> //connector->SetInput(thresholder->GetOutput());<BR> connector->SetInput(reader->GetOutput());<BR> connector->Update();<BR> // Fast Marching Ends.</DIV>
<DIV> <BR>/*<BR> image_to_real_Filter->SetInput( reader->GetOutput() );</DIV>
<DIV> typedef itk::FastMarchingImageFilter< RealImageType,RealImageType > FastMarchingFilterType;<BR> FastMarchingFilterType::Pointer m_FastMarchingImageFilter = FastMarchingFilterType::New();<BR> m_FastMarchingImageFilter->SetSpeedConstant( 1.0 );<BR> m_FastMarchingImageFilter->SetInput(image_to_real_Filter->GetOutput());<BR> typedef itk::CannySegmentationLevelSetImageFilter<itk::Image< RealPixelType, 3 >,itk::Image< RealPixelType, 3 >> CannySegmentationLevelSetFilterType;<BR> CannySegmentationLevelSetFilterType::Pointer m_CannySegmentationLevelSetFilter = CannySegmentationLevelSetFilterType::New();</DIV>
<DIV> m_CannySegmentationLevelSetFilter->SetInput( m_FastMarchingImageFilter->GetOutput() );<BR> <BR> m_CannySegmentationLevelSetFilter->SetFeatureImage( image_to_real_Filter ->GetOutput() );<BR> real_to_image_Filter->SetInput(m_CannySegmentationLevelSetFilter->GetOutput());<BR> connector->SetInput(real_to_image_Filter->GetOutput());<BR>*/ <BR> }<BR> catch (itk::ExceptionObject &ex)<BR> {<BR> std::cout << ex << std::endl;<BR> return EXIT_FAILURE;<BR> }</DIV>
<DIV> // Parse the parameters<BR> int count = 1;<BR> char *dirname = NULL;<BR> double opacityWindow = 4096;<BR> double opacityLevel = 2048;<BR> int blendType = 0;<BR> int clip = 0;<BR> double reductionFactor = 1.0;<BR> double frameRate = 10.0;<BR> char *fileName = 0;<BR> int fileType = 0; </DIV>
<DIV> bool independentComponents = true;<BR> <BR> // Create the renderer, render window and interactor<BR> vtkRenderer *renderer = vtkRenderer::New();<BR> vtkRenderWindow *renWin = vtkRenderWindow::New();<BR> renWin->AddRenderer(renderer);</DIV>
<DIV> // Connect it all. Note that funny arithmatic on the <BR> // SetDesiredUpdateRate - the vtkRenderWindow divides it<BR> // allocated time across all renderers, and the renderer<BR> // divides it time across all props. If clip is<BR> // true then there are two props<BR> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<BR> iren->SetRenderWindow(renWin);<BR> iren->SetDesiredUpdateRate(frameRate / (1+clip)); </DIV>
<DIV> iren->GetInteractorStyle()->SetDefaultRenderer(renderer);</DIV>
<DIV> // Read the data<BR> //typedef itk::VTKImageExport< MaskImageType > ExportFilter2Type;<BR> //ExportFilter2Type::Pointer itkExporter2 = ExportFilter2Type::New();<BR> //itkExporter2->SetInput( filter->GetOutput() );<BR> vtkDataSetMapper* geom = vtkDataSetMapper::New();<BR> geom->SetInput(connector->GetOutput());<BR> geom->Update();<BR> vtkContourFilter * contour = vtkContourFilter::New();<BR> contour->SetInput( connector->GetOutput() );<BR> contour->SetValue(0, 128); // edges of a binary image with values 0,255<BR> vtkPolyDataMapper * polyMapper = vtkPolyDataMapper::New();<BR> vtkActor * polyActor = vtkActor::New();</DIV>
<DIV> //polyActor->SetMapper( polyMapper );<BR> <BR> //polyMapper->SetInput( contour->GetOutput() );<BR> //polyMapper->SetInput( geom->GetOutput() );<BR> //polyMapper->ScalarVisibilityOff();<BR> <BR> // Set the scene<BR> polyActor->SetMapper( geom );<BR> vtkProperty * vtkproperty = vtkProperty::New();<BR> vtkproperty->SetAmbient(0.5);<BR> vtkproperty->SetDiffuse(0.1);<BR> vtkproperty->SetSpecular(0.5);<BR> vtkproperty->SetColor(0.5,0.4,0.0);<BR> vtkproperty->SetLineWidth(2.0);<BR> vtkproperty->SetRepresentationToWireframe();<BR> vtkproperty->SetOpacity(0.1);</DIV>
<DIV> polyActor->SetProperty( vtkproperty );<BR> <BR> //renderer->AddActor( polyActor );</DIV>
<DIV> vtkImageData *input = 0;<BR> input = connector->GetOutput();</DIV>
<DIV> vtkImageResample *resample = vtkImageResample::New();<BR> if ( reductionFactor < 1.0 )<BR> {<BR> resample->SetInput(input);<BR> resample->SetAxisMagnificationFactor(0, reductionFactor);<BR> resample->SetAxisMagnificationFactor(1, reductionFactor);<BR> resample->SetAxisMagnificationFactor(2, reductionFactor);<BR> }</DIV>
<DIV> // Create our volume and mapper<BR> vtkVolume *volume = vtkVolume::New();<BR> vtkGPUVolumeRayCastMapper *mapper = vtkGPUVolumeRayCastMapper::New();<BR> <BR> // Add a box widget if the clip option was selected<BR> vtkBoxWidget *box = vtkBoxWidget::New();<BR> if (clip)<BR> {<BR> box->SetInteractor(iren);<BR> box->SetPlaceFactor(1.01);<BR> if ( reductionFactor < 1.0 )<BR> { <BR> box->SetInput(resample->GetOutput());<BR> }<BR> else<BR> {<BR> box->SetInput(input);<BR> }<BR> <BR> box->SetDefaultRenderer(renderer);<BR> box->InsideOutOn();<BR> box->PlaceWidget();<BR> vtkBoxWidgetCallback *callback = vtkBoxWidgetCallback::New();<BR> callback->SetMapper(mapper);<BR> box->AddObserver(vtkCommand::InteractionEvent, callback);<BR> callback->Delete();<BR> box->EnabledOn();<BR> box->GetSelectedFaceProperty()->SetOpacity(0.0);<BR> }</DIV>
<DIV> if ( reductionFactor < 1.0 )<BR> {<BR> mapper->SetInputConnection( resample->GetOutputPort() );<BR> }<BR> else<BR> {<BR> mapper->SetInput(input);<BR> //mapper->SetInputConnection( read->GetOutputPort() );<BR> }<BR> <BR> // Set the sample distance on the ray to be 1/2 the average spacing<BR> double spacing[3];<BR> if ( reductionFactor < 1.0 )<BR> {<BR> resample->GetOutput()->GetSpacing(spacing);<BR> }<BR> else<BR> {<BR> input->GetSpacing(spacing);<BR> }<BR> <BR>// mapper->SetSampleDistance( (spacing[0]+spacing[1]+spacing[2])/6.0 );<BR>// mapper->SetMaximumImageSampleDistance(10.0);<BR> <BR> // Create our transfer function<BR> vtkColorTransferFunction *colorFun = vtkColorTransferFunction::New();<BR> vtkPiecewiseFunction *opacityFun = vtkPiecewiseFunction::New();<BR> <BR> // Create the property and attach the transfer functions<BR> vtkVolumeProperty *property = vtkVolumeProperty::New();<BR> property->SetIndependentComponents(independentComponents);<BR> property->SetColor( colorFun );<BR> property->SetScalarOpacity( opacityFun );<BR> property->SetInterpolationTypeToLinear();</DIV>
<DIV> // connect up the volume to the property and the mapper<BR> volume->SetProperty( property );<BR> volume->SetMapper( mapper );</DIV>
<DIV> // Depending on the blend type selected as a command line option, <BR> // adjust the transfer function<BR> switch ( blendType )<BR> {<BR> // MIP<BR> // Create an opacity ramp from the window and level values.<BR> // Color is white. Blending is MIP.<BR> case 0:<BR> colorFun->AddRGBSegment(0.0, 1.0, 1.0, 1.0, 255.0, 1.0, 1.0, 1.0 );<BR> opacityFun->AddSegment( opacityLevel - 0.5*opacityWindow, 0.0, <BR> opacityLevel + 0.5*opacityWindow, 1.0 );<BR> mapper->SetBlendModeToMaximumIntensity();<BR> break;<BR> <BR> // CompositeRamp<BR> // Create a ramp from the window and level values. Use compositing<BR> // without shading. Color is a ramp from black to white.<BR> case 1:<BR> colorFun->AddRGBSegment( opacityLevel - 0.5*opacityWindow, 0.0, 0.0, 0.0, <BR> opacityLevel + 0.5*opacityWindow, 1.0, 1.0, 1.0 );<BR> opacityFun->AddSegment( opacityLevel - 0.5*opacityWindow, 0.0, <BR> opacityLevel + 0.5*opacityWindow, 1.0 );<BR> mapper->SetBlendModeToComposite();<BR> property->ShadeOff();<BR> break;<BR> <BR> // CompositeShadeRamp<BR> // Create a ramp from the window and level values. Use compositing<BR> // with shading. Color is white.<BR> case 2:<BR> colorFun->AddRGBSegment( 0.0, 1.0, 1.0, 1.0, 255.0, 1.0, 1.0, 1.0 );<BR> opacityFun->AddSegment( opacityLevel - 0.5*opacityWindow, 0.0, <BR> opacityLevel + 0.5*opacityWindow, 1.0 );<BR> mapper->SetBlendModeToComposite();<BR> property->ShadeOn();<BR> break;</DIV>
<DIV> // CT_Skin<BR> // Use compositing and functions set to highlight skin in CT data<BR> // Not for use on RGB data<BR> case 3:<BR> colorFun->AddRGBPoint( -3024, 0, 0, 0, 0.5, 0.0 );<BR> colorFun->AddRGBPoint( -1000, .62, .36, .18, 0.5, 0.0 );<BR> colorFun->AddRGBPoint( -500, .88, .60, .29, 0.33, 0.45 );<BR> colorFun->AddRGBPoint( 3071, .83, .66, 1, 0.5, 0.0 );<BR> <BR> opacityFun->AddPoint(-3024, 0, 0.5, 0.0 );<BR> opacityFun->AddPoint(-1000, 0, 0.5, 0.0 );<BR> opacityFun->AddPoint(-500, 1.0, 0.33, 0.45 );<BR> opacityFun->AddPoint(3071, 1.0, 0.5, 0.0);</DIV>
<DIV> mapper->SetBlendModeToComposite();<BR> property->ShadeOn();<BR> property->SetAmbient(0.1);<BR> property->SetDiffuse(0.9);<BR> property->SetSpecular(0.2);<BR> property->SetSpecularPower(10.0);<BR> property->SetScalarOpacityUnitDistance(0.8919);<BR> break;<BR> <BR> // CT_Bone<BR> // Use compositing and functions set to highlight bone in CT data<BR> // Not for use on RGB data<BR> case 4:<BR> colorFun->AddRGBPoint( -3024, 0, 0, 0, 0.5, 0.0 );<BR> colorFun->AddRGBPoint( -16, 0.73, 0.25, 0.30, 0.49, .61 );<BR> colorFun->AddRGBPoint( 641, .90, .82, .56, .5, 0.0 );<BR> colorFun->AddRGBPoint( 3071, 1, 1, 1, .5, 0.0 );<BR> <BR> opacityFun->AddPoint( -3024, 0, 0.5, 0.0 );<BR> opacityFun->AddPoint( -16, 0, .49, .61 );<BR> opacityFun->AddPoint( 641, .72, .5, 0.0 );<BR> opacityFun->AddPoint( 3071, .71, 0.5, 0.0 );</DIV>
<DIV> mapper->SetBlendModeToComposite();<BR> property->ShadeOn();<BR> property->SetAmbient(0.1);<BR> property->SetDiffuse(0.9);<BR> property->SetSpecular(0.2);<BR> property->SetSpecularPower(10.0);<BR> property->SetScalarOpacityUnitDistance(0.8919);<BR> break;<BR> <BR> // CT_Muscle<BR> // Use compositing and functions set to highlight muscle in CT data<BR> // Not for use on RGB data<BR> case 5:<BR> colorFun->AddRGBPoint(-3024, 0, 0, 0, 0.5, 0.0);<BR> colorFun->AddRGBPoint(-155, .55, .25, .15, 0.5, .92);<BR> colorFun->AddRGBPoint(217, .88, .60, .29, 0.33, 0.45);<BR> colorFun->AddRGBPoint(420, 1, .94, .95, 0.5, 0.0);<BR> colorFun->AddRGBPoint(3071, .83, .66, 1, 0.5, 0.0);<BR> <BR> opacityFun->AddPoint(-3024, 0, 0.5, 0.0);<BR> opacityFun->AddPoint(-155, 0, 0.5, 0.92);<BR> opacityFun->AddPoint(217, .68, 0.33, 0.45);<BR> opacityFun->AddPoint(420,.83, 0.5, 0.0);<BR> opacityFun->AddPoint(3071, .80, 0.5, 0.0);</DIV>
<DIV> mapper->SetBlendModeToComposite();<BR> property->ShadeOn();<BR> property->SetAmbient(0.1);<BR> property->SetDiffuse(0.9);<BR> property->SetSpecular(0.2);<BR> property->SetSpecularPower(10.0);<BR> property->SetScalarOpacityUnitDistance(0.8919);<BR> break;<BR> <BR> // RGB_Composite<BR> // Use compositing and functions set to highlight red/green/blue regions<BR> // in RGB data. Not for use on single component data<BR> case 6:<BR> opacityFun->AddPoint(0, 0.0);<BR> opacityFun->AddPoint(5.0, 0.0);<BR> opacityFun->AddPoint(30.0, 0.05);<BR> opacityFun->AddPoint(31.0, 0.0);<BR> opacityFun->AddPoint(90.0, 0.0);<BR> opacityFun->AddPoint(100.0, 0.3);<BR> opacityFun->AddPoint(110.0, 0.0);<BR> opacityFun->AddPoint(190.0, 0.0);<BR> opacityFun->AddPoint(200.0, 0.4);<BR> opacityFun->AddPoint(210.0, 0.0);<BR> opacityFun->AddPoint(245.0, 0.0);<BR> opacityFun->AddPoint(255.0, 0.5);</DIV>
<DIV> mapper->SetBlendModeToComposite();<BR> property->ShadeOff();<BR> property->SetScalarOpacityUnitDistance(1.0);<BR> break;<BR> default:<BR> vtkGenericWarningMacro("Unknown blend type.");<BR> break;<BR> }<BR> <BR> // Set the default window size<BR> renWin->SetSize(600,600);<BR> renWin->Render();</DIV>
<DIV> if ( !mapper->IsRenderSupported(renWin, property) )<BR> {<BR> cout << "This mapper is unsupported on this platform" << endl;<BR> exit(EXIT_FAILURE);<BR> }<BR> </DIV>
<DIV> // Add the volume to the scene<BR> renderer->AddVolume( volume );</DIV>
<DIV> renderer->ResetCamera();<BR> // interact with data<BR> renWin->Render();</DIV>
<DIV> iren->Start();</DIV>
<DIV> opacityFun->Delete();<BR> colorFun->Delete();<BR> property->Delete();<BR> <BR> box->Delete();<BR> volume->Delete();<BR> mapper->Delete();<BR> //reader->Delete();<BR> resample->Delete();<BR> renderer->Delete();<BR> renWin->Delete();<BR> iren->Delete();<BR> contour->Delete();<BR> geom->Delete();<BR> polyMapper->Delete();<BR> polyActor->Delete();<BR> vtkproperty->Delete();<BR> <BR> return 0; <BR>}<BR></DIV>
<DIV>***********************************************************************************************</DIV>
<DIV> </DIV>
<DIV>But when I do the <SPAN>executable program( Navogation.exe )</SPAN></DIV>
<DIV><SPAN>
<P>Picture a flash,then disappear.</P>
<P>system prompt:<This mapper is unsurpported on this paltform></P>
<P>my graphics card as:ATI Radeon HD 4350</P>
<P>Need I change my graphics card ?</P>
<P>thanks.</P></SPAN></DIV></DIV><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>