[vtkusers] Marching Cubes Cropping Problem

Yusuf OEZBEK nasil122002 at yahoo.de
Tue Apr 6 21:33:08 EDT 2010


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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100407/c9426b18/attachment.htm>


More information about the vtkusers mailing list