[vtkusers] Flattening a probed surface

Jonathan Ruiz Peinado jonathan.ruiz3 at gmail.com
Wed May 30 06:42:40 EDT 2012


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/c7b15e01/attachment.htm>


More information about the vtkusers mailing list