[vtkusers] a strange error when using vtk on MFC

jiang-gx jxjx at sjtu.edu.cn
Tue Jul 27 10:49:01 EDT 2004


hi everyone:
    there was a strange mistake occured   when i used the vtk in the MFC platform, the problem is as below:

i wrote a new vtk class named "vtkCenterLine" which calculates the skeleton line of input image such as  the tharm image. and a use the vtkMarchingCube meanwhile.

when i write the pipline like :
"
	pDoc->centerLine->SetInput(pDoc->v16->GetOutput());
	pDoc->centerLineMapper ->SetInput(pDoc->centerLine->GetOutput());
	pDoc->centerLineActor ->SetMapper(pDoc->centerLineMapper );
	pDoc->centerLineActor ->GetProperty()->SetColor(1,0,0);
	this->ren1 ->AddActor(pDoc->centerLineActor);		
        
        pDoc->volume_Extractor->SetInput(pDoc->v16->GetOutput());
		pDoc->volume_Extractor->SetValue(0, 500);
		pDoc->volume_Stripper->SetInput(pDoc->volume_Extractor->GetOutput());
		pDoc->volume_Mapper->SetInput(pDoc->volume_Stripper->GetOutput());
		pDoc->volume_Mapper->ScalarVisibilityOff();
		pDoc->volume_Actor ->SetMapper(pDoc->volume_Mapper);
		pDoc->volume_Actor->GetProperty()->SetDiffuseColor(0.8, 0.8, 0.6);
		pDoc->volume_Actor->GetProperty()->SetSpecular(.3);
		pDoc->volume_Actor->GetProperty()->SetSpecularPower(20);
		pDoc->volume_Actor->GetProperty()->SetOpacity(0.5);
	    this->ren1 ->AddActor(pDoc->volume_Actor);   

"
it get a right result.

but when i change the code a little as
"
		pDoc->volume_Extractor->SetInput(pDoc->v16->GetOutput());
		pDoc->volume_Extractor->SetValue(0, 500);
		pDoc->volume_Stripper->SetInput(pDoc->volume_Extractor->GetOutput());
		pDoc->volume_Mapper->SetInput(pDoc->volume_Stripper->GetOutput());
		pDoc->volume_Mapper->ScalarVisibilityOff();
		pDoc->volume_Actor ->SetMapper(pDoc->volume_Mapper);
		pDoc->volume_Actor->GetProperty()->SetDiffuseColor(0.8, 0.8, 0.6);
		pDoc->volume_Actor->GetProperty()->SetSpecular(.3);
		pDoc->volume_Actor->GetProperty()->SetSpecularPower(20);
		pDoc->volume_Actor->GetProperty()->SetOpacity(0.5);
	    this->ren1 ->AddActor(pDoc->volume_Actor);



	pDoc->centerLine->SetInput(pDoc->v16->GetOutput());
	pDoc->centerLineMapper ->SetInput(pDoc->centerLine->GetOutput());
	pDoc->centerLineActor ->SetMapper(pDoc->centerLineMapper );
	pDoc->centerLineActor ->GetProperty()->SetColor(1,0,0);
	this->ren1 ->AddActor(pDoc->centerLineActor);
"

a error will occured at the runtime. 

why ?  thank you for answerring!!




More information about the vtkusers mailing list