Hi All,

Regarding the writing process of vtkPolyData with colors/scalars,

I'd like to open my colored vtkPolyData on Paraview.
Thus, I wrote the polyData by vtkXMLPolyWriter as the snippet code:

    // set the shape of my poly data
    vtkSmartPointer<vtkPolyData> poly =
vtkSmartPointer<vtkPolyData>::New();
    // set scalars on my vtkPolyData
    poly->GetPointData()->SetScalars(shape_array);
    poly->Update();

    vtkSmartPointer<vtkXMLPolyDataWriter> writerXml =
vtkSmartPointer<vtkXMLPolyDataWriter>::New();
    writerXml->SetInput(poly);
    writerXml->SetFileName("myPoly.vtp");
    writerXml->Write();

The polyData is opened in Paraview but* without* the scalars/colors.
Is there a problem with this writing process via Mitk or have I missed
something?


Regards,
Miri

On Mon, Jan 9, 2012 at 2:56 PM, Alfred Franz <[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
>
> Fax: (+49) 6221/42-2345
>
> eMail: [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