[vtkusers] Flattening a probed surface

Jonathan Ruiz Peinado jonathan.ruiz3 at gmail.com
Wed May 30 08:50:53 EDT 2012


No , actually sampleVolume.GetOutput() doesn't have a method GetScalars(),
and sampleVolume.GetOutput().GetPointData().GetScalars() returns null.

Maybe I wrote it wrong in a previus mail.

¿ But could I get the scalars from the volume using the surface points as
reference ?

// Probe the volume with the extruded surface
meshedSurface.SetInputConnection(1,
dicomImage.getNormalized().GetOutputPort());
meshedSurface.SetInput(0, surface);

Scalar =
dicomImage.getNormalized().GetOutput().GetScalarComponentAsDouble(surfacecoord.x,
surfacecoord.x, surfacecoord.x,
0);

2012/5/30 Sebastien Jourdain <sebastien.jourdain at kitware.com>

> You previously told me that the following line was working
>
> sampleVolume.GetOutput().GetScalars()
>
> BTW sampleVolume is not a volume but a meshed surface.
>
> On Wed, May 30, 2012 at 6:41 AM, Jonathan Ruiz Peinado
> <jonathan.ruiz3 at gmail.com> wrote:
> > An update of the previous code, seems that setDimensions is going to
> > be deprecate at some point and is just for backwards compatibility so
> this
> > is how it's looks now using setExtent instead:
> >
> >  //image_data.SetDimensions(width, height, 1);
> > image_data.SetExtent(0, width - 1 ,0,  height - 1, 0, 0);
> > image_data.SetScalarTypeToDouble();
> > image_data.SetNumberOfScalarComponents(1);
> > image_data.SetSpacing(1.0, 1.0, 1.0);
> > image_data.SetOrigin(0.0, 0.0, 0.0);
> > image_data.SetScalarComponentFromDouble(0, 0, 0, 0, 200.0);
> > image_data.AllocateScalars();
> >
> > Now I'm trying to figure out  how to get the scalars from the probed
> surface
> >
> > sampleVolume.GetOutput().GetPointData().GetScalars() it's returning me a
> > null pointer...
> > any suggestion?
> >
> > 2012/5/30 Jonathan Ruiz Peinado <jonathan.ruiz3 at gmail.com>
> >>
> >> Ok, so I misunderstand some basics of VTK.
> >> I'm not sure about the meaning of cell or point, thanks it shows me
> >> something more about it.
> >> Is there some URL where I can go to get the basic theory about it ?
> >>
> >> This is how the code looks now, fisrt I'm going to show you how I'm
> >> Building the surface:
> >>
> >> rows = spline.GetOutput().GetNumberOfPoints();
> >> col =dicomImage.getNormalized().GetOutput().GetDimensions()[2];
> >> for (int row = 0; row < rows; row++)
> >>         {
> >>             for (int col = 0; col < cols; col++)
> >>             {
> >>                 double [] p = new double [3];
> >>                 line.GetPoint(row, p);
> >>                 x[0] = p[0] + direction[0] * col * spacing;
> >>                 x[1] = p[1] + direction[1] * col * spacing;
> >>                 x[2] = p[2] + direction[2] * col * spacing;
> >>                 points.InsertPoint(cnt++, x);
> >>             }
> >>         }
> >>
> >> An now how I've fixed the code that was wrong in my previous message:
> >> vtkImageData image_data= new vtkImageData();
> >>
> >> int width = spline.GetOutput().GetNumberOfPoints();
> >> int height = dicomImage.getNormalized().GetOutput().GetDimensions()[2];
> >>
> >>
> >> image_data.SetDimensions(width, height, 1); // 1 because I just want an
> >> slice by now
> >> //image_data.SetSpacing();
> >>
> >>
> >> Do I need to set the Spacing of the image_data or it has a valid default
> >> value?
> >>
> >>
> >>
> >>
> >> 2012/5/29 Sebastien Jourdain <sebastien.jourdain at kitware.com>
> >>>
> >>> The dimension is related to the number of points....
> >>>
> >>> Meaning one dimension will be the number of points that compose your
> >>> spline and the other will be the number of iteration the swipe is
> >>> doing.
> >>>
> >>> Seb
> >>>
> >>> On Tue, May 29, 2012 at 12:46 PM, jruiz <jonathan.ruiz3 at gmail.com>
> wrote:
> >>> > Thanks, I'm going to follow your instructions step by step, first I'm
> >>> > trying
> >>> > to get de surface area to set the dimension of the image data.
> >>> >
> >>> > Is it even close ? I'm getting the length for the extruded spline as
> >>> > "width"
> >>> > and "height" is the length of the extrusion. I guess this values need
> >>> > to be
> >>> > multiply by the spacing what I get from the source image.
> >>> >
> >>> > vtkImageData image_data= new vtkImageData();
> >>> >
> >>> > double[] spacing =
> dicomImage.getNormalized().GetOutput().GetSpacing();
> >>> >
> >>> > double width = spline.GetLength() * spacing[0];
> >>> > double height = surfaceHeight * spacing[2];
> >>> >
> >>> > image_data.SetDimensions(width, height, 1);
> >>> >
> >>> > --
> >>> > View this message in context:
> >>> >
> http://vtk.1045678.n5.nabble.com/Flattening-a-probed-surface-tp5713443p5713466.html
> >>> > Sent from the VTK - Users mailing list archive at Nabble.com.
> >>> > _______________________________________________
> >>> > Powered by www.kitware.com
> >>> >
> >>> > Visit other Kitware open-source projects at
> >>> > http://www.kitware.com/opensource/opensource.html
> >>> >
> >>> > Please keep messages on-topic and check the VTK FAQ at:
> >>> > http://www.vtk.org/Wiki/VTK_FAQ
> >>> >
> >>> > Follow this link to subscribe/unsubscribe:
> >>> > http://www.vtk.org/mailman/listinfo/vtkusers
> >>
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120530/901bed17/attachment.htm>


More information about the vtkusers mailing list