<div dir="ltr">Use GetScalarTypeAsString()<br><br>Jothy<br><br><div class="gmail_quote">On Wed, Sep 28, 2011 at 2:21 PM, speedy <span dir="ltr">&lt;<a href="mailto:markenjodsalz@gmx.net">markenjodsalz@gmx.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Thanks a lot for your reply Dominique!<br>
It is much faster indeed to use GetScalarPointer() instead of iterating<br>
through the pixels. I still have a problem though: My class doesn&#39;t know the<br>
pixeltype of the image beforehand, but I have to cast the pointer to it. How<br>
can I achieve this? I know there&#39;s the method<br>
<br>
Image-&gt;GetScalarType(),<br>
<br>
but it returns an integer value and I don&#39;t know how to proceed with it..<br>
<br>
<br>
Dominique Töpfer wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; a similar question was discussed here:<br>
&gt; <a href="http://vtk.1045678.n5.nabble.com/Fast-element-access-of-vtkImageData-td4640137.html#none" target="_blank">http://vtk.1045678.n5.nabble.com/Fast-element-access-of-vtkImageData-td4640137.html#none</a><br>
&gt;<br>
&gt; HTH<br>
&gt; Dominique<br>
&gt;<br>
&gt; On <a href="tel:27.09.2011%2015" value="+12709201115">27.09.2011 15</a>:47, speedy wrote:<br>
&gt;&gt; Sorry if this question actually has a simple answer, but what is the<br>
&gt;&gt; fastest<br>
&gt;&gt; way to set every pixel of a vtkImageData to zero (or any other value<br>
&gt;&gt; fitting<br>
&gt;&gt; in its pixeltype)?<br>
&gt;&gt; I&#39;ve tried vtkImageThreshold, but it doesn&#39;t seem to do anything or maybe<br>
&gt;&gt; I<br>
&gt;&gt; am using it wrong:<br>
&gt;&gt;<br>
&gt;&gt;    threshold = vtkSmartPointer&lt;vtkImageThreshold&gt;::New();<br>
&gt;&gt;    threshold-&gt;SetInput(Image);<br>
&gt;&gt;    threshold-&gt;ReplaceOutOn();<br>
&gt;&gt;    threshold-&gt;SetOutValue(Value);<br>
&gt;&gt;    threshold-&gt;ThresholdByLower(maximum_image_value);<br>
&gt;&gt;    threshold-&gt;Update();<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <a href="http://vtk.1045678.n5.nabble.com/Set-ImageData-to-zero-tp4845442p4845442.html" target="_blank">http://vtk.1045678.n5.nabble.com/Set-ImageData-to-zero-tp4845442p4845442.html</a><br>
&gt;&gt; Sent from the VTK - Users mailing list archive at Nabble.com.<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt;&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Thus spake the master programmer:<br>
&gt;      &quot;After three days without programming, life becomes meaningless.&quot;<br>
&gt;<br>
&gt; -- The Tao of Programming by Geoffry James<br>
&gt;<br>
&gt; Dominique Töpfer, Dipl.-Inform.<br>
&gt; Institute of Medical Physics<br>
&gt; University of Erlangen<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>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Set-ImageData-to-zero-tp4845442p4849109.html" target="_blank">http://vtk.1045678.n5.nabble.com/Set-ImageData-to-zero-tp4845442p4849109.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 <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: <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>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothybasu K Selvaraj<br>PhD Student<br>University of Liverpool<br>Liverpool,UK<br></div><br>
</div>