<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Dear all,<br><br><div>I am trying to cut a ROI from the fixed image based on the mask of ROI. Both fixed image and ROI mask are in the same format 128 X 128 X 124 as input. I can cut the image properly by using the following code (only the core part, and the whole code are attached. I have two questions here. Firstly, I just feel this is not the right way to do, there should be some function to do this. Secondly, I dont know how to get the total index number in one dimension, and I manually put the 128, 128, 124 into the code.</div><div><br></div><div><br></div><div><div> for(i = 0; i < 128; i++)</div><div> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> std::cerr << i << std::endl;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> for(j = 0; j < 128; j++)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> for(k = 0; k < 124; k++)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> pixelLocation[0] = i;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> pixelLocation[1] = j;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> pixelLocation[2] = k;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> inputPixelValue = fixedImage->GetPixel(pixelLocation);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> maskPixelValue = maskImage->GetPixel(pixelLocation);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> pixelValue = inputPixelValue * maskPixelValue;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> outputImage->SetPixel( pixelLocation, pixelValue);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> }</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> }</div><div> }</div><div> </div><div><br></div>--------------------------------<br>Xi Liang<br><br>ÁºÜç<br>--------------------------------<br><br><br></div>                                            <br /><hr />Windows Live: Make it easier for your friends to see <a href='http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009' target='_new'>what you¡¯re up to on Facebook.</a></body>
</html>