[vtkusers] The value of ESP was not properly saved????

yaolu at engineering.uiowa.edu yaolu at engineering.uiowa.edu
Mon Feb 27 11:26:27 EST 2006


Dear All,

When I run my program, I got a Error: "The value of ESP was not properly saved
across a function call. This is usually a result of calling a function declared
with one calling convention with a function pointer declared with a different
calling convention."

First time call "AddLabelContour()", it's fine. Failed when it is called second
time.

I didn't use compile option "/Gz" in the compiler.

Any suggestion is absolutely welcome! Thanks a lot!

Here is my code:
                int m_NumberOfLabel;
		struct Label{
			int LabelIndex;
			std::string LabelName;
			vtkActor * LabelContour;
		};
		std::vector<Label> m_LabelList;

void BrainCSIGUIImplementation::AddLabelContour(){

	m_NumberOfLabel++;

	Label *LatestLabel = new Label;	//memory allocation
	(*LatestLabel).LabelIndex = m_NumberOfLabel;
	(*LatestLabel).LabelName = LabelNameInput->value();
	(*LatestLabel).LabelContour = GenerateContour();

	m_LabelList.push_back( *LatestLabel );

	for (int i=0; i<m_NumberOfLabel; i++){
		std::cout<<"m_LabelList[i]: "<<std::endl;
		std::cout<<m_LabelList[i].LabelIndex<<std::endl;
		std::cout<<(m_LabelList[i].LabelName).c_str()<<std::endl;
		std::cout<<m_LabelList[i].LabelContour<<std::endl;
	}//end of for

	//Visualization
	m_Renderer->AddActor(m_LabelList[m_NumberOfLabel-1].LabelContour);
	fltkRenderWindowInteractor->show();
	fltkRenderWindowInteractor->redraw();

}//end of AddLabelContour

vtkActor* BrainCSIGUIImplementation::GenerateContour(){

	m_itkLabel2vtkFilter = itk2vtkFilterType::New();
	m_itkLabel2vtkFilter->SetInput(m_ResampledLabel);

	vtkContourFilter *labelcontour = vtkContourFilter::New();
	labelcontour->SetInput(m_itkLabel2vtkFilter->GetOutput());
	labelcontour->SetValue(0,0.5);

	vtkPolyDataNormals *labelnormals = vtkPolyDataNormals::New();
	labelnormals->SetInput(labelcontour->GetOutput());
	labelnormals->SetFeatureAngle(60.0);

	vtkStripper *labelstripper = vtkStripper::New();
	labelstripper->SetInput(labelnormals->GetOutput());

	vtkPolyDataMapper *labelmapper = vtkPolyDataMapper::New();
	labelmapper->SetInput(labelstripper->GetOutput());
	labelmapper->ScalarVisibilityOff();

	vtkActor *labelactor = vtkActor::New();
	labelactor->SetMapper(labelmapper);
	labelactor->PickableOff();
	labelactor->GetProperty()->SetOpacity(0.5);
	labelactor->GetProperty()->SetSpecular(0.3);
	labelactor->GetProperty()->SetSpecularPower(20);
	std::cout<<labelactor<<std::endl;

	return labelactor;

}//end of GenerateContour

Jenny




More information about the vtkusers mailing list