Hello Miranda,

there have been a few more or less similar questions on the mailing list before. Perhaps this answer might help you:

http://sourceforge.net/mailarchive/forum.php?thread_name=1330946969.14497.11.camel%40mbi073.dkfz-heidelberg.de&forum_name=mitk-users

Greets,

Alfred

Am 15.03.2012 22:57, schrieb Miranda Jacob:

Hello,

I am currently using MITK and it is working well. We currently allow the user to create individual ROI’s which are vtkpolydata but to display them in our MITK project we append all of them together and then add them to a single mitk::Surface. I want to be able to change the individual color of each ROI. In order to do this I was hoping to be able to change the color of each vtkpolydata before it is appended to the rest of the polydata’s. Is this possible? Do you know of any way to change the color of the individual vtkpolydata’s?

Here is the code that appends all of them together into a single mitk::Surface.

intnumberOfROIs = surface->GetSizeOfPolyDataSeries();

if ( numberOfROIs > 1 )

      {

// append all the polydata info from 1,2,3,...n all to the 0'th index vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();

for(int nROIcnt=1;nROIcnt<numberOfROIs;++nROIcnt)

            {

                  vtkPolyData* pindex = surface->GetVtkPolyData(nROIcnt);

if(pindex)

                  {

// Here is where I want to change the color for each polydata pindex->SetColorForPolyData();//this would be the function to do what I want

appendFilter->AddInputConnection(pindex->GetProducerPort());

                  }

            }

            appendFilter->Update();

vtkSmartPointer<vtkCleanPolyData> cleanFilter = vtkSmartPointer<vtkCleanPolyData>::New();

cleanFilter->SetInputConnection(appendFilter->GetOutputPort());

            cleanFilter->Update();

            surface->SetVtkPolyData(cleanFilter->GetOutput(),0);

            surface->SetRequestedRegionToLargestPossibleRegion();

      }

Thank you,

Miranda Jacobson



------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to