Hi Miri,

the code looks fine to me. Although, you did not show how you created the 
lookup table and how you set the scalars. Here is one example how it worked for 
me:

Assume your table range is from 0 to 10, your mesh is contained in the 
vtkPolyData polyData, and your scalars are stored in vtkDoubleArray* scalars.

// set scalars to poly data
polyData->GetPointData()->SetScalars(scalars);
mitk::Surface::Pointer surface = mitk::Surface::New();
surface->SetVtkPolyData(polyData);

// create vtk lookup table
vtkLookupTable* vtkLut = vtkLookupTable::New();
vtkLut->SetTableRange(0.0,10.0);
vtkLut->Build();
// create mitk lookup table
mitk::LookupTable::Pointer mitkLut = mitk::LookupTable::New();
mitkLut->SetVtkLookupTable(vtkLut);
// create lookup table property
mitk::LookupTableProperty::Pointer mitkLutProp = 
mitk::LookupTableProperty::New(mitkLut);

// create node and add properties
mitk::DataNode::Pointer node = mitk::DataNode::New();
node->SetData(surface);
node->SetProperty("LookupTable",mitkLutProp);
node->SetBoolProperty("scalar visibility",true);
node->SetFloatProperty("ScalarsRangeMaximum",10);
node->SetBoolProperty("color mode",true);
node->Update();

Regards,
Alex


Von: Miri Trope [mailto:[email protected]]
Gesendet: Samstag, 14. Januar 2012 20:18
An: Seitel, Alexander
Cc: mitk-users
Betreff: Re: [mitk-users] Visualization of a colored surface

Hi Alexander,

Thank you for the helpful idea.
(isn't this the right command- with argument two? : 
Node->SetProperty("LookupTable",LookupTableProp);)

Anyway, attached the code's snippet which still not visualizes the colored 
surface on the 2d planes.
- any suggestions?

mitk::LookupTableProperty::Pointer myFilter::getLookUpTableProp()
{
    mitk::LookupTable::Pointer mitk_lut = mitk::LookupTable::New();
    mitk_lut->SetVtkLookupTable(m_vtk_lut);
    mitk::LookupTableProperty::Pointer LookupTableProp = 
mitk::LookupTableProperty::New();
    LookupTableProp->SetLookupTable(mitk_lut);
    return LookupTableProp;
}

        mitk::LookupTableProperty::Pointer LookupTableProp = 
mitk::LookupTableProperty::New();
        LookupTableProp = myFilter->getLookUpTableProp();

        mitk::DataNode::Pointer Node = mitk::DataNode::New();
        Node->SetData( Surface );
        Node->SetProperty("scalar visibility", mitk::BoolProperty::New(true));
        Node->SetProperty("color mode", mitk::BoolProperty::New(true));
        Node->SetProperty("material.specularCoefficient", 
mitk::FloatProperty::New(0.5));
        Node->SetProperty("LookupTable",LookupTableProp);
        Node->SetName(scalpNodeName.str());
        Node->Update();


On Thu, Jan 12, 2012 at 4:29 PM, Alexander Seitel 
<[email protected]<mailto:[email protected]>> wrote:
Hi Miri,

you could also try to add a LookupTableProperty to your surface node you
want to have colored. That will allow you to specify the range of colors
your scalars will be visualized. That worked for my case also for the 2D
planes. What you have to do is:

- Create your specific lookup table mitk::LookupTable::Pointer lut
- Set the lookup table as a property to your node:
node->SetProperty("LookupTable",lut);

Regards,
Alex

On Mon, 2012-01-09 at 21:22 +0100, Miri Trope wrote:
> Hi Alfred,
>
> Thank you for your answer, you helped me with the saving process.
>
> However, a colored surface are well represented (with variety of
> colors as has been set by the scalars) only on the 3d view, but not on
> the 2d plans (on the 2d planes I'm only watching a blue surface,
> without the variety of colors).
>
> It might be something which I've missed in my code ... a snap code of
> the relevant parts is attached.
>
>
> Regards,
> Miri
>
>
> On Mon, Jan 9, 2012 at 2:56 PM, Alfred Franz
> <[email protected]<mailto:[email protected]>> wrote:
>         Hi Miri,
>
>         in MITK a Surface is shown in the planes views (Transversal,
>         Sagital and Coronal). You only have to take care that the
>         crosshair is at the right place. Colors are also shown in the
>         2d views.
>
>         The color property is an MITK object which the
>         vtkPolyDataWriter doesn't know. An easy way to save your
>         surface with colors is to use the MITK scene serialization,
>         which is also used if you click "File" => "Save Project". It
>         saves all data nodes from the data storage with the MITK
>         properties (like color, etc.). If you only want to save one
>         data node you can use the scene serialization by creating a
>         new data storage and only adding your data note.
>
>         Greets,
>
>         Alfred
>
>         Am 07.01.2012 00:27, schrieb Miri Trope:
>
>         > Hi All,
>         >
>         > My program calculates scalars on vtkPolyData. So, by the
>         > following methods a colored surface has been achieved:
>         >
>         >
>         > command in filter (in myModuleLib):
>         >
>         >         surface->GetPointData()->SetScalars(vtkArray);
>         >
>         > commands in filterView (in plugIn directory):
>         >
>         >         mitk::DataNode::Pointer surfaceNode =
>         > mitk::DataNode::New();
>         >
>         >         surfaceNode->SetProperty("scalar visibility",
>         > mitk::BoolProperty::New(true));
>         >
>         >         surfaceNode->SetProperty("color mode",
>         > mitk::BoolProperty::New(true));
>         >
>         >
>         > Now, I'm wondering how can I achieve the following
>         > abilities:
>         >
>         > 1. watch the colored surface either on the planes view (nor
>         > just on the 3d in the MITK's gui view)
>         >
>         > 2. write the colored surface (with the scalars) so it can be
>         > watched later with his colors.
>         >     vtkPolyDataWriter can write the surface's scalars too?
>         >
>         >
>         >
>         > Regards,
>         > Miri
>         >
>
>
>
>         --
>         Alfred Franz
>
>         Deutsches Krebsforschungszentrum
>
>         Abteilung Medizinische und Biologische Informatik
>
>         Im Neuenheimer Feld 280
>
>         69120 Heidelberg
>
>         Telefon: (+49) 6221/42-2330<tel:%28%2B49%29%206221%2F42-2330>
>
>         Fax: (+49) 6221/42-2345<tel:%28%2B49%29%206221%2F42-2345>
>
>         eMail: [email protected]<mailto:[email protected]>
>
>         http://mbi.dkfz-heidelberg.de
>
>


------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to