by the way the pattern is not always the sameone, and I just note that is not a pattern sometimes<br><br><div class="gmail_quote">2012/5/31 Jonathan Ruiz Peinado <span dir="ltr">&lt;<a href="mailto:jonathan.ruiz3@gmail.com" target="_blank">jonathan.ruiz3@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div> </div><div>This is how code looks now, I&#39;ve got to use imageData.SetScalarTypeToUnsignedChar(); insetad Double because I got an error when I tried to show the image using imageActor, any way I&#39;m not getting the image that I spected, not sure why, I&#39;m getting a pattern repeated 3 times, just like the old tvs snow, do someone see what is wrong ?</div>

<div>thanks! </div><div><br></div><div>Hope it works for you jhroyer.</div><div><br></div><div>        int width = spline.GetOutput().GetNumberOfPoints();        </div><div>        int height = dicomImage.getNormalized().GetOutput().GetDimensions()[2] + 1;</div>

<div>        </div><div>        //image_data.SetDimensions(width, height, 1);</div><div>        imageData.SetExtent(0, width - 1 ,0,  height - 1, 0, 0);</div><div>        imageData.SetScalarTypeToUnsignedChar();</div><div>

        imageData.SetNumberOfScalarComponents(1);</div><div>        imageData.SetSpacing(1.0, 1.0, 1.0);</div><div>        imageData.SetOrigin(0.0, 0.0, 0.0);        </div><div>        imageData.AllocateScalars();</div><div>

        meshedSurface.Update();   </div><div>        </div><div>        for (int j=0; j &lt; height; j++)</div><div>        {</div><div>            for(int i = 0; i &lt; width;i++ )</div><div>            {                </div>

<div>                //System.out.println((j*width) + i) ;</div><div>                imageData.SetScalarComponentFromDouble(i, j, 0, 0, meshedSurface.GetOutput().GetPointData().GetScalars().GetTuple1( (j*width) + i ) );</div>

<div>            }</div><div>        }</div><div>        imageActor.SetInput(imageData);</div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote">2012/5/30 Jonathan Ruiz Peinado <span dir="ltr">&lt;<a href="mailto:jonathan.ruiz3@gmail.com" target="_blank">jonathan.ruiz3@gmail.com</a>&gt;</span><br>

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



&gt;&gt; &gt;&gt;&gt; &gt; Sent from the VTK - Users mailing list archive at Nabble.com.<br>
&gt;&gt; &gt;&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt;&gt;&gt; &gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; Visit other Kitware open-source projects at<br>
&gt;&gt; &gt;&gt;&gt; &gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt;&gt; &gt;&gt;&gt; &gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; &gt;&gt;&gt; &gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>