<p class="MsoNormal" style="text-autospace:none">I
write follow code and<span style> </span>there is an error(error
:<span style="font-size:9.5pt;font-family:Consolas">gridVoxel[volCompIndex] =
inVolPtr[volCompIndex];)</span></p>
<p class="MsoNormal">Is my<span style> </span><span style> </span>code is correct for access voxel value of
vtkimagedata?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks alot</p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style="color:green">// get increments for volume and for accumulation buffer</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>vtkIdType
byteIncVol[3]; <span style="color:green">//x,y,z</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>volumedata->GetIncrements(byteIncVol[0],byteIncVol[1],byteIncVol[2]);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style="color:green">// this will store the position of the pixel being looked
at currently</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style="color:blue">int</span> currentPos[3]; <span style="color:green">//x,y,z</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style="color:blue">int</span> numVolumeComponents =
volumedata->GetNumberOfScalarComponents() - 1; <span style="color:green">//
subtract 1 because of the alpha channel</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style> </span>volumedata->Update();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style> </span><span style="color:blue">void</span>
*inVolPtr =volumedata->GetScalarPointer();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style> </span><span style="color:blue">int</span><span style> </span>*gridVoxel;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style> </span>volumedata->GetScalarPointer();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style> </span><span style="color:blue">double</span>
*outExt=volumedata->GetBounds();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style="color:blue">for</span> (<span style="color:blue">int</span> c = 0; c
< numVolumeComponents; c++)</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>{</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style>
</span><span style="color:blue">for</span> (currentPos[2] = outExt[4];
currentPos[2] <= outExt[5]; currentPos[2]++)</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>{</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style="color:blue">for</span> (currentPos[1] = outExt[2]; currentPos[1] <=
outExt[3]; currentPos[1]++)</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>{</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style="color:blue">for</span> (currentPos[0] = outExt[0]; currentPos[0] <=
outExt[1]; currentPos[0]++)</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>{</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span><span style="color:blue">int</span> volCompIndex =
(currentPos[0]*byteIncVol[0])+(currentPos[1]*byteIncVol[1])+(currentPos[2]*byteIncVol[2])+c;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>gridVoxel[volCompIndex]
= inVolPtr[volCompIndex];</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>}
</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>}</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>}</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><span style> </span>}</span></p>
<p class="MsoNormal"> </p>