<div dir="ltr"><div><div>Dear Shiwei,<br></div>if we keep the conversation on the mailing list, you will have more chances to have your question answered and hopefully solved.<br><br></div>As for the question, the pixel index type depends on the image type:<br>
<pre class="">ImageType<span class="">::</span><span class="">IndexType</span> index<span class="">;</span></pre>If your image is a volume, then index will be an array of dimension 3. Thus, you&#39;d do:<br><pre class="">
  index<span class="">[</span><span class="">0</span><span class="">]</span> <span class="">=</span> <span class="">0</span><span class="">;</span>
  index<span class="">[</span><span class="">1</span><span class="">]</span> <span class="">=</span> <span class="">0</span><span class="">;</span>
  index<span class="">[</span>2<span class="">]</span> <span class="">=</span> <span class="">0</span><span class="">;</span><br></pre>You should also take into account ITK&#39;s coordinate convention in order to set the indexes properly and choose the one you want to/expect to.<br>
<div><div><div><div><div><div class="gmail_extra">Then you&#39;d do:<br><pre class="">ImageType<span class="">::PixelType </span>pixelValue = image<span class="">-</span><span class="">&gt;</span>GetPixel<span class="">(</span>index<span class="">)</span></pre>
And then you&#39;d do your processing.<br><br></div><div class="gmail_extra">The GetLargestPossibleRegion() function will return you a RegionType type, which is used to specify a subset region of the image. Furthermore, GetPixel() is not a member of itk::ImageRegion, you cannot acces the pixel through the region.<br>
</div><div class="gmail_extra"><br></div><div class="gmail_extra">What you call Db should be a pointer to your image, like:<br><pre class=""><span class="">typedef</span> itk<span class="">::</span><span class="">Image</span><span class="">&lt;</span><span class="">YOUR_PIXEL_TYPE</span><span class=""></span><span class=""></span>, <span class="">YOUR_IMAGE_DIMENSION</span><span class="">&gt;</span>  ImageType<span class="">;</span>
 
ImageType<span class="">::</span><span class="">Pointer</span> image <span class="">=</span> ImageType<span class="">::</span><span class="">New</span><span class="">(</span><span class="">)</span><span class="">;</span><br>
</pre></div><div class="gmail_extra">That is:<br><pre class="">ImageType<span class="">::</span><span class="">Pointer</span> Db <span class="">=</span> ImageType<span class="">::</span><span class="">New</span><span class="">(</span><span class="">)</span><span class="">;</span></pre>
<br>HTH,<br>JON HAITZ<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 24 October 2013 10:33, shiwei <span dir="ltr">&lt;<a href="mailto:swingsw89@163.com" target="_blank">swingsw89@163.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;font-size:14px;font-family:arial">Thank you very much for help me with that! In my understanding, the code should be like the following?<div>
<div><span style="white-space:pre-wrap">                                        </span>Index3DType pixelIndex;</div><div><span style="white-space:pre-wrap">                                        </span>pixelIndex[0] = Point1(0,0);   // x position</div><div><span style="white-space:pre-wrap">                                        </span>pixelIndex[1] = Point1(1,0);   // y position</div>
<div><span style="white-space:pre-wrap">                                        </span>pixelIndex[2] = Point1(2,0);</div><div><span style="white-space:pre-wrap">                                        </span>ImageType::PixelType   pixelValue = Db-&gt;GetPixel( pixelIndex );</div><div><span style="white-space:pre-wrap">                                        </span>std::cout &lt;&lt; Db-&gt;GetPixel(pixelIndex)&lt;&lt;endl;</div>
<div><span style="white-space:pre-wrap">                                        </span>if(pixelValue==0)</div><div><span style="white-space:pre-wrap">                                        </span>{</div><span style="white-space:pre-wrap">                                                </span>...</div><div><span style="white-space:pre-wrap">                                        </span>}</div>
<div><br><span style="white-space:pre-wrap">                                                </span><br>And one more question is that, shall I use &quot;<span style="line-height:1.7"> </span><span style="line-height:1.7">Db-&gt;GetPixel( pixelIndex )</span><span style="line-height:1.7">&quot; or &quot;</span><span style="line-height:1.7">Db-&gt;GetLargestPossibleRegion()-&gt;</span><span style="line-height:1.7">GetPixel( pixelIndex )</span><span style="line-height:1.7">&quot; instead of the image?</span></div>
<div><div class="h5"><div><br><div></div><div></div><br>At 2013-10-24 14:59:48,&quot;Jon Haitz Legarreta&quot; &lt;<a href="mailto:jhlegarreta@vicomtech.org" target="_blank">jhlegarreta@vicomtech.org</a>&gt; wrote:<br> <blockquote style="padding-left:1ex;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)">
<div dir="ltr"><div>Hi Shiwei,<br>try using<br><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px">image-&gt;GetPixel( pixelIndex );</span><br><br></div>You may want to have a look at some older posts on the same issue to see if they are helpful:<br>

<a href="http://itk-insight-users.2283740.n2.nabble.com/Get-pixel-Data-td6035296.html" target="_blank">http://itk-insight-users.2283740.n2.nabble.com/Get-pixel-Data-td6035296.html</a><br><div><div><div class="gmail_extra">
<a href="http://www.itk.org/pipermail/insight-users/2006-January/016517.html" target="_blank">http://www.itk.org/pipermail/insight-users/2006-January/016517.html</a><br>
<br></div><div class="gmail_extra">HTH,<br></div><div class="gmail_extra">JON HAITZ<br><br><br></div><div class="gmail_extra"><div class="gmail_quote">On 24 October 2013 08:08, shiwei <span dir="ltr">&lt;<a href="mailto:swingsw89@163.com" target="_blank">swingsw89@163.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="line-height:1.7;font-size:14px;font-family:arial">Hi,all<div>       Now I run into a problem is that in a Big 3D volume named Db, I want to have the following result like thie code in Matlab: </div>

<div><span style="white-space:pre-wrap">                                </span><b>if Db( Point1(1,1) , Point1(2,1) , Point1(3,1) ) == 0 </b></div><div><span style="white-space:pre-wrap">        </span>And I know Point1(1,1),<span style="line-height:1.7">Point1(2,1),</span><span style="line-height:1.7">Point1(3,1), I wonder if there is a way in ITK to locate this coordinate and get the value of the voxel to check whether it&#39;s zero? Maybe not use a SliceIterator in the whole 3d volume? For before this code, I have already iterate the Db 3D volume?</span></div>

<div><span style="line-height:1.7"><br></span></div><div><span style="line-height:1.7">                    &amp;nbs
 p;                                                                                                         Thank you</span></div><span><font color="#888888"><div><span style="line-height:1.7">                                                                                                                                 shiwei</span></div>

</font></span></div><br><br><span title="neteasefooter"><span></span></span><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>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div></div></div></div>
</blockquote></div></div></div></div><br><br><span title="neteasefooter"><span></span></span></blockquote></div><br></div></div></div></div></div></div></div>