[vtkusers] Marching Cubes Cropping Problem
Bill Lorensen
bill.lorensen at gmail.com
Wed Apr 7 08:09:34 EDT 2010
pMapper->ScalarVisibilityOff();
On Wed, Apr 7, 2010 at 5:46 AM, Henrik Westerberg
<henrik.westerberg at crg.es> wrote:
>
> Hi Yusuf,
>
> You probably have some scalar data associated with your polydata coming from your input files.
> So try turning off scalar visibility on the mapper:
>
> pMapper->ScalarVisibilityOff():
>
> hth,
> Henrik
> ________________________________________
> From: vtkusers-bounces at vtk.org [vtkusers-bounces at vtk.org] On Behalf Of Yusuf OEZBEK [nasil122002 at yahoo.de]
> Sent: 07 April 2010 03:33
> To: vtkusers at vtk.org
> Cc: nasil122002 at gmail.com
> Subject: [vtkusers] Marching Cubes Cropping Problem
>
> Hello all,
>
> I cut a 3D-image (generated with Marching Cubes) with vtkBoxClipDataSet, the function already works well. But the problem is the color of the 3D image is changed each time (red, blue), although I have it defined as white GetProperty()->SetColor( 1, 1, 1 ), and I can not reset it anymore. What should I do to make the color of result-image white? My code is shown below:
>
> Thank you!
>
>
>
>
> mode3D = vtkInteractorStyleTrackballCamera::New();
>
> renderer3D = vtkRenderer::New();
> renderWindow3D = vtkRenderWindow::New();
> renderWindow3D->AddRenderer(renderer3D);
>
> displayImage3D->SetRenderWindow(renderWindow3D);
> displayImage3D->SetInteractorStyle(mode3D);
> displayImage3D->Initialize();
>
>
> reader2D->SetFileDimensionality( 3 );
> reader2D->SetDirectoryName(selectedDirectory);
> reader2D->SetDataExtent( 0,reader2D->GetWidth()-1 , 0,reader2D->GetHeight()-1, 0,numberOfFilesOnSelectedFolder-1);
> reader2D->SetDataOrigin(0.0, 0.0, 0.0);
> reader2D->SetDataSpacing( 1,1,1 );
> reader2D->SetNumberOfScalarComponents( 1 );
> reader2D->SetDataByteOrderToBigEndian();
> reader2D->UpdateWholeExtent();
>
>
> marchingCubesCut = vtkMarchingCubes::New();
> marchingCubesCut->SetInput(reader2D->GetOutput()); //vtkDICOMImageReader
> marchingCubesCut->GenerateValues(1, (int)this->sliderRangeMin->value()-(int)this->sliderRangeMax->value()/2, (int)this->sliderRangeMin->value()+(int)this->sliderRangeMax->value()/2);
>
> if (geCutterSagSelectMin > geCutterSagSelectMax){
> int temp;
> temp = geCutterSagSelectMin;
> geCutterSagSelectMin = geCutterSagSelectMax;
> geCutterSagSelectMax = temp;
> }
>
> if (geCutterCorSelectMin > geCutterCorSelectMax){
> int temp;
> temp = geCutterCorSelectMin;
> geCutterCorSelectMin = geCutterCorSelectMax;
> geCutterCorSelectMax = temp;
> }
>
> if (geCutterAxSelectMin > geCutterAxSelectMax){
> int temp;
> temp = geCutterAxSelectMin;
> geCutterAxSelectMin = geCutterAxSelectMax;
> geCutterAxSelectMax = temp;
> }
>
> const double minpoint4[] = { geCutterSagSelectMin,geCutterCorSelectMin,geCutterAxSelectMin };
> const double maxpoint4[] = { geCutterSagSelectMax, geCutterCorSelectMax, geCutterAxSelectMax };
>
>
> clipper = vtkBoxClipDataSet::New();
> clipper->SetInput(marchingCubesCut->GetOutput());
> clipper->GenerateClippedOutputOff();
> clipper->SetBoxClip(minpoint4[0], maxpoint4[0], minpoint4[1], maxpoint4[1],minpoint4[2], maxpoint4[2]);
>
> surface = vtkDataSetSurfaceFilter::New();;
> surface->SetInputConnection(0, clipper->GetOutputPort(0));
>
> pMapper = vtkPolyDataMapper::New();
> pMapper->SetInputConnection(0, surface->GetOutputPort(0));
>
> actor3DCut = vtkActor::New();
> actor3DCut->SetMapper(pMapper);
> actor3DCut->GetProperty()->SetColor( 1, 1, 1 ); //Define the color of 3D-Image here
>
> camera3D = vtkCamera::New();
> camera3D->SetViewUp(0, 0, -1);
> camera3D->SetPosition(0, 1, 0);
> camera3D->SetFocalPoint(0, 0, 0);
> camera3D->ComputeViewPlaneNormal();
> camera3D->Azimuth(20);
>
> renderer3D->AddActor(actor3DCut);
> renderer3D->SetActiveCamera(camera3D);
> renderer3D->ResetCamera();
> camera3D->Dolly(1.3);
> renderer3D->ResetCameraClippingRange();
>
>
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
> http://mail.yahoo.com
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list