Hi,<div>i'm trying to access every single voxel of a 3d image and change some values. In particular, i want to change that values that are not black; every value has to be increased by a value of 100 for example. If a voxel has value of 10, i want to give it value of 110.</div>
<div><br></div><div>Here is my code:</div><div><br></div><div>imageCT->DisconnectPipeline();</div><div><div>for(i=0;i<512;i++)</div><div> {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>for(j=0;j<512;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<311;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>pixelIndex[0] = i; // x position</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>pixelIndex[1] = j; // y position</div><div>
<span class="Apple-tab-span" style="white-space:pre">                        </span>pixelIndex[2] = k; // z position</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>ImageType::PixelType pixelValuePT = imagePT->GetPixel( pixelIndex );</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>ImageType::PixelType newValue = pixelValueCT+100;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>if(pixelValueCT!=0)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>{<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>imageCT->SetPixel( pixelIndex, newValue );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>}<span class="Apple-tab-span" style="white-space:pre">        </span></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><br></div><div>This code doesn't do the work well. Do you know how to change it?</div><div>Thank you,</div><div>bye,</div><div><br></div><div>Marco</div></div>