<div>Yes, now it's getting the array correctly, thanks!</div><div><br></div><br><div class="gmail_quote">2012/5/30 Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Try to update the pipeline before accessing its data...<br>
<br>
On Wed, May 30, 2012 at 8:50 AM, Jonathan Ruiz Peinado<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:jonathan.ruiz3@gmail.com">jonathan.ruiz3@gmail.com</a>> wrote:<br>
> No , actually sampleVolume.GetOutput() doesn't have a method GetScalars(),<br>
> and sampleVolume.GetOutput().GetPointData().GetScalars() returns null.<br>
><br>
> Maybe I wrote it wrong in a previus mail.<br>
><br>
> ¿ But could I get the scalars from the volume using the surface points as<br>
> reference ?<br>
><br>
> // Probe the volume with the extruded surface<br>
> meshedSurface.SetInputConnection(1,<br>
> dicomImage.getNormalized().GetOutputPort());<br>
> meshedSurface.SetInput(0, surface);<br>
><br>
> Scalar =<br>
> dicomImage.getNormalized().GetOutput().GetScalarComponentAsDouble(surfacecoord.x, surfacecoord.x, surfacecoord.x,<br>
> 0);<br>
><br>
> 2012/5/30 Sebastien Jourdain <<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>><br>
>><br>
>> You previously told me that the following line was working<br>
>><br>
>> sampleVolume.GetOutput().GetScalars()<br>
>><br>
>> BTW sampleVolume is not a volume but a meshed surface.<br>
>><br>
>> On Wed, May 30, 2012 at 6:41 AM, Jonathan Ruiz Peinado<br>
>> <<a href="mailto:jonathan.ruiz3@gmail.com">jonathan.ruiz3@gmail.com</a>> wrote:<br>
>> > An update of the previous code, seems that setDimensions is going to<br>
>> > be deprecate at some point and is just for backwards compatibility so<br>
>> > this<br>
>> > is how it's looks now using setExtent instead:<br>
>> ><br>
>> > //image_data.SetDimensions(width, height, 1);<br>
>> > image_data.SetExtent(0, width - 1 ,0, height - 1, 0, 0);<br>
>> > image_data.SetScalarTypeToDouble();<br>
>> > image_data.SetNumberOfScalarComponents(1);<br>
>> > image_data.SetSpacing(1.0, 1.0, 1.0);<br>
>> > image_data.SetOrigin(0.0, 0.0, 0.0);<br>
>> > image_data.SetScalarComponentFromDouble(0, 0, 0, 0, 200.0);<br>
>> > image_data.AllocateScalars();<br>
>> ><br>
>> > Now I'm trying to figure out how to get the scalars from the probed<br>
>> > surface<br>
>> ><br>
>> > sampleVolume.GetOutput().GetPointData().GetScalars() it's returning me a<br>
>> > null pointer...<br>
>> > any suggestion?<br>
>> ><br>
>> > 2012/5/30 Jonathan Ruiz Peinado <<a href="mailto:jonathan.ruiz3@gmail.com">jonathan.ruiz3@gmail.com</a>><br>
>> >><br>
>> >> Ok, so I misunderstand some basics of VTK.<br>
>> >> I'm not sure about the meaning of cell or point, thanks it shows me<br>
>> >> something more about it.<br>
>> >> Is there some URL where I can go to get the basic theory about it ?<br>
>> >><br>
>> >> This is how the code looks now, fisrt I'm going to show you how I'm<br>
>> >> Building the surface:<br>
>> >><br>
>> >> rows = spline.GetOutput().GetNumberOfPoints();<br>
>> >> col =dicomImage.getNormalized().GetOutput().GetDimensions()[2];<br>
>> >> for (int row = 0; row < rows; row++)<br>
>> >> {<br>
>> >> for (int col = 0; col < cols; col++)<br>
>> >> {<br>
>> >> double [] p = new double [3];<br>
>> >> line.GetPoint(row, p);<br>
>> >> x[0] = p[0] + direction[0] * col * spacing;<br>
>> >> x[1] = p[1] + direction[1] * col * spacing;<br>
>> >> x[2] = p[2] + direction[2] * col * spacing;<br>
>> >> points.InsertPoint(cnt++, x);<br>
>> >> }<br>
>> >> }<br>
>> >><br>
>> >> An now how I've fixed the code that was wrong in my previous message:<br>
>> >> vtkImageData image_data= new vtkImageData();<br>
>> >><br>
>> >> int width = spline.GetOutput().GetNumberOfPoints();<br>
>> >> int height = dicomImage.getNormalized().GetOutput().GetDimensions()[2];<br>
>> >><br>
>> >><br>
>> >> image_data.SetDimensions(width, height, 1); // 1 because I just want an<br>
>> >> slice by now<br>
>> >> //image_data.SetSpacing();<br>
>> >><br>
>> >><br>
>> >> Do I need to set the Spacing of the image_data or it has a valid<br>
>> >> default<br>
>> >> value?<br>
>> >><br>
>> >><br>
>> >><br>
>> >><br>
>> >> 2012/5/29 Sebastien Jourdain <<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>><br>
>> >>><br>
>> >>> The dimension is related to the number of points....<br>
>> >>><br>
>> >>> Meaning one dimension will be the number of points that compose your<br>
>> >>> spline and the other will be the number of iteration the swipe is<br>
>> >>> doing.<br>
>> >>><br>
>> >>> Seb<br>
>> >>><br>
>> >>> On Tue, May 29, 2012 at 12:46 PM, jruiz <<a href="mailto:jonathan.ruiz3@gmail.com">jonathan.ruiz3@gmail.com</a>><br>
>> >>> wrote:<br>
>> >>> > Thanks, I'm going to follow your instructions step by step, first<br>
>> >>> > I'm<br>
>> >>> > trying<br>
>> >>> > to get de surface area to set the dimension of the image data.<br>
>> >>> ><br>
>> >>> > Is it even close ? I'm getting the length for the extruded spline as<br>
>> >>> > "width"<br>
>> >>> > and "height" is the length of the extrusion. I guess this values<br>
>> >>> > need<br>
>> >>> > to be<br>
>> >>> > multiply by the spacing what I get from the source image.<br>
>> >>> ><br>
>> >>> > vtkImageData image_data= new vtkImageData();<br>
>> >>> ><br>
>> >>> > double[] spacing =<br>
>> >>> > dicomImage.getNormalized().GetOutput().GetSpacing();<br>
>> >>> ><br>
>> >>> > double width = spline.GetLength() * spacing[0];<br>
>> >>> > double height = surfaceHeight * spacing[2];<br>
>> >>> ><br>
>> >>> > image_data.SetDimensions(width, height, 1);<br>
>> >>> ><br>
>> >>> > --<br>
>> >>> > View this message in context:<br>
>> >>> ><br>
>> >>> > <a href="http://vtk.1045678.n5.nabble.com/Flattening-a-probed-surface-tp5713443p5713466.html" target="_blank">http://vtk.1045678.n5.nabble.com/Flattening-a-probed-surface-tp5713443p5713466.html</a><br>
>> >>> > Sent from the VTK - Users mailing list archive at Nabble.com.<br>
>> >>> > _______________________________________________<br>
>> >>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >>> ><br>
>> >>> > Visit other Kitware open-source projects at<br>
>> >>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >>> ><br>
>> >>> > Please keep messages on-topic and check the VTK FAQ at:<br>
>> >>> > <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>> >>> ><br>
>> >>> > Follow this link to subscribe/unsubscribe:<br>
>> >>> > <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>> >><br>
>> >><br>
>> ><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
</div></div></blockquote></div><br>