[vtkusers] show celldata on vtkImagePlaneWidget

Putte, T.B. (Tom) van der tom.vanderputte at tno.nl
Wed May 11 10:28:44 EDT 2011


Hi Dean,

Thanks for the info. I'll try the structuredGrid approach.

Tom
-----Original Message-----
From: Dean Inglis [mailto:dean.inglis at camris.ca] 
Sent: woensdag 11 mei 2011 16:09
To: Putte, T.B. (Tom) van der; vtkusers at vtk.org
Subject: Re: [vtkusers] show celldata on vtkImagePlaneWidget

Hi Tom,

this is fundamentally how VTK handles image data: data values are associated
with point locations with pixel corners defined by points, and is different
than, for example, how ITK handles image data (see ITK users guide page 40,
chapter 4: Data Representation) wherein point locations are the pixel 
centers.
You can view your data discretely with my suggestion below and if the origin 
of
your data needs to be shifted by half spacing you could use 
vtkImageChangeInformation.
Alternatey, maybe you could try creating a vtkStructuredGrid and then do

grid->GetCellData()->SetScalars( my_scalar_value_array );

and use vtkImplicitPlaneWidget to interact with and visualize the data.

Dean

----- Original Message ----- 
From: "Putte, T.B. (Tom) van der" <tom.vanderputte at tno.nl>
To: <vtkusers at vtk.org>
Cc: "Dean Inglis" <dean.inglis at camris.ca>
Sent: Wednesday, May 11, 2011 9:05 AM
Subject: RE: [vtkusers] show celldata on vtkImagePlaneWidget


Hi Dean,

Thanks, I tried this, but the problem is that I'm trying to display discrete 
scalar data. So converting cell data to points will actually change values 
(throught the vtkCellDataToPointData interpolation), as well as shift the 
image 0.5 x spacing distance in all directions.

Suppose I would really want to display the celldata as accurately as 
possible on an intersection plane (perhaps even with the (intersection of 
the) mesh displayed to make the boundaries between cells more clear), is it 
even possible to use the ImagePlaneWidget? Or should I use the implicit 
plane widget? Or make something entirely from scratch?

Thanks again,
Tom


-----Original Message-----
From: Dean Inglis [mailto:dean.inglis at camris.ca]
Sent: woensdag 11 mei 2011 14:37
To: vtkusers at vtk.org
Cc: Putte, T.B. (Tom) van der
Subject: Re: [vtkusers] show celldata on vtkImagePlaneWidget

Hi Tom,

you are doing the right thing by converting cell data to point data in this
case.  You could try
setting the interpolation to nearest neighbor and turning interpolation off:

iPlaneWidgetX.SetResliceInterpolateToNearestNeighbour();
iPlaneWidgetX.TextureInterpolateOff();

Dean

Hi,

Using Activiz, I'm trying to display imagedata (CELLDATA, not pointdata) on
a vtkImagePlaneWidget, just as simple gridcells like this:
(https://picasaweb.google.com/lh/photo/SYdgbXrXm-4SRfVHCufBLfK3gj7O8KOK36SDLJLIWK8?feat=directlink)
but it doesn't show anything. What I try is this:

  vtkXMLImageDataReader reader = vtkXMLImageDataReader.New();
  reader.SetFileName(imgFileNameTotal);
  reader.SetCellArrayStatus("CellData", 1); //only celldata
  reader.SetPointArrayStatus("Scalars_", 0); //no pointdata
  reader.Update();

  //Create ImagePlaneWidget
  vtkImagePlaneWidget iPlaneWidgetX = new vtkImagePlaneWidget();
  iPlaneWidgetX.SetInput(reader.GetOutput());
  iPlaneWidgetX.SetPlaneOrientationToXAxes();
  iPlaneWidgetX.SetSliceIndex(10);

  //Rendering, Camera & interactors
  vtkRenderer ren1 =
renderWindowControl1.RenderWindow.GetRenderers().GetFirstRenderer();
  vtkRenderWindow renWin = renderWindowControl1.RenderWindow;
  vtkRenderWindowInteractor interActor = renWin.GetInteractor();

  vtkInteractorStyleTrackballCamera style = new
  vtkInteractorStyleTrackballCamera();

  interActor.SetInteractorStyle(style);
  iPlaneWidgetX.SetInteractor(interActor);
  iPlaneWidgetX.On();

  renWin.SetSize(500, 500);
  renWin.Render();

However, when I add this

  vtkCellDataToPointData pointData = new vtkCellDataToPointData();
  pointData.SetInput( reader.GetOutput());

and change the iPlaneWidget's input:
  iPlaneWidgetX.SetInput(pointData.GetOutput());

It does show the data, but as interpolated pointdata, which is not what I
want.

Is the imagePlaneWidget unable to display celldata, and should I tackle this
a different way?

Cheers,
Tom
This e-mail and its contents are subject to the DISCLAIMER at
http://www.tno.nl/emaildisclaimer


This e-mail and its contents are subject to the DISCLAIMER at 
http://www.tno.nl/emaildisclaimer

This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/emaildisclaimer




More information about the vtkusers mailing list