Hello,
Thank you for the reply. Will a lookup table allow me to color each
individual polydata a different color?? So I set the lookup table for each
polydata?? Also I am not familiar with the scalars part of vtk. The first
thing the example says to do is set the scalars but I'm not sure where they
got the scalar from??
Here is what the example said
In order to visualize scalars on a PolyData you need to:
* Pass these scalar to the PolyData:
polydata->GetPointData()->SetScalars(scalars);
* Create a lookup table (vtkLookupTable) that maps each scalar to a
particular color.
* Create a mitk::LookupTable that wraps the vtkLookupTable.
* In the DataNode that represents the surface, you must set the
LookupTable property:
node->SetProperty("LookupTable", mitkLookupTable);
* Also in the node you must set the maximum and minimum of the scalars
range:
node->SetFloatProperty("ScalarsRangeMinimum", minimum);
node->SetFloatProperty("ScalarsRangeMaximum", maximum);
Now your scalar should be shown above the surface, with the respective
color assigned by the lookup table.
The code we use does not use scalars so I'm not sure how to incorporate this
into my code.
From: Alfred Franz [mailto:[email protected]]
Sent: Monday, March 26, 2012 1:51 AM
To: Miranda Jacob
Cc: [email protected]
Subject: Re: [mitk-users] Changing color of individual vtkpolydata in a
mitk::surface
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
<http://sourceforge.net/mailarchive/forum.php?thread_name=1330946969.14497.1
1.camel%40mbi073.dkfz-heidelberg.de&forum_name=mitk-users>
&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.
int numberOfROIs = 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