[vtk-developers] Overlay many vtkpolydata on dicom image
bamb
bamb.bakang at gmail.com
Mon May 5 15:20:01 EDT 2014
Hi !
I am a begginner user of VTK librairies.
I am making a application which need to display
many contours, which overlay on DICOM slice.
I tried to use vtkContourWidget , but I can display one contour at a time (
EDITMODE comment)
If somebody knows how or has an example which could help me out.
It would be very nice.
My problem is after ViewMode comment
Here is my code ( for one contour a time) :
bool found=false;
//Make precedent actor invisible
Activity::GetActivity().MakeActorNotVisible(this->mSliceCurrentIndex);
Activity::GetActivity().MakeActorVisible(position);
//keeps new actor index
this->mSliceCurrentIndex = position;
if(
EDITMODE==this->mode){/************************************EDITMODE*******************/
//Find out associated contour
int indexContour = this->GetContourMatchingImage(position);
//If contour was found, then initialize Contour Widget with it
if( indexContour >= 0)
{
//Set Representation
this->GetContourWidget(0)->SetRepresentation(this->mAllContoursRepresentations.at(this->idContourSetViewActivated)
.at(indexContour).second.GetRepresentation());
//1 for "define" state , 2 for "manipulate" state
this->GetContourWidget(0)->SetWidgetState(2);
//And put interactor on.
this->GetContourWidget(0)->On();
}
/*Otherwise instanciate a new Representation of the contour , initialize
Contour Widget
and save this representation in a vector ( member)*/
else
{
//Instanciate a new representation
Contour contour(1,0,1);
//save it in the vector
this->mAllContoursRepresentations.at(this->idContourSetViewActivated).push_back(std::pair<unsigned
int , Contour> (position,contour));
/*Prepare ContourWidget By setting representation
and Poutine ^^ interactor on*/
this->GetContourWidget(0)->SetRepresentation(contour.GetRepresentation());
this->GetContourWidget(0)->On();
this->GetContourWidget(0)->Initialize();
}
}
else
if(VIEWMODE==this->mode){/************************************VIEWMODE*****************************************/
std::vector<int> contourPosition;
for(int i =0; i < CONTOUR_SET_MAX; i++){
this->SetActivatedViewContourSetId(i);
contourPosition.push_back(this->GetContourMatchingImage(position));
}
for(int i =0; i < contourPosition.size(); i++){
//If contour was found, then initialize Contour Widget with it
if( contourPosition.at(i) >= 0)
{
//Set this
this->GetContourWidget(i)->SetRepresentation(this->mAllContoursRepresentations.at(i)
.at(contourPosition.at(i)).second.GetRepresentation());
this->GetContourWidget(i)->SetWidgetState(2);
//And put interactor on.
this->GetContourWidget(i)->On();
}
}
}
/**********************Render*******************************/
this->Render();
--
View this message in context: http://vtk.1045678.n5.nabble.com/Overlay-many-vtkpolydata-on-dicom-image-tp5726989.html
Sent from the VTK - Dev mailing list archive at Nabble.com.
More information about the vtk-developers
mailing list