<div>hello:</div>
<div>I want to extract object edges of CT(dicom format) image with sobel operator. But there isn&#39;t any object edges at all when&nbsp;I render the processed image. So there must be something wrong with my code or method. it will be great if you can tell me what&#39;s wrong with my code.
</div>
<div>thank you very much!</div>
<div>the code is as follow:</div>
<div>&nbsp;</div>
<div>vtkDICOMImageReader *reader= vtkDICOMImageReader::New();<br>&nbsp;reader-&gt;SetFileName(&quot;ankle.dcm&quot;);<br>&nbsp;reader-&gt;Update();<br>&nbsp;int wide=reader-&gt;GetWidth();<br>&nbsp;int height=reader-&gt;GetHeight();<br>&nbsp;vtkImageData *imgData=reader-&gt;GetOutput();
</div>
<div>
<p>&nbsp;double temp[10],temp1,temp2,sobelVal;<br>&nbsp;for(int i=1;i&lt;wide-1;i++)//Sobel grads operator 3¡Á3 model</p>
<p>for(int j=1;j&lt;height-1;j++)<br>&nbsp;{</p>
<p>¡¡//µã(i,j)°ËÁÚÓòµÄÏñËØÖµ<br>&nbsp;&nbsp;temp[1]=imgData-&gt;GetScalarComponentAsDouble(i-1,j-1,0,0);<br>&nbsp;&nbsp;temp[2]=imgData-&gt;GetScalarComponentAsDouble(i,j-1,0,0);<br>&nbsp;&nbsp;temp[3]=imgData-&gt;GetScalarComponentAsDouble(i+1,j-1,0,0);<br>&nbsp;
<br>&nbsp;&nbsp;temp[4]=imgData-&gt;GetScalarComponentAsDouble(i-1,j,0,0);<br>&nbsp;&nbsp;&nbsp;temp[6]=imgData-&gt;GetScalarComponentAsDouble(i+1,j,0,0);<br>&nbsp;<br>&nbsp;&nbsp;temp[7]=imgData-&gt;GetScalarComponentAsDouble(i-1,j+1,0,0);<br>&nbsp;&nbsp;temp[8]=imgData-&gt;GetScalarComponentAsDouble(i,j+1,0,0);
<br>&nbsp;&nbsp;temp[9]=imgData-&gt;GetScalarComponentAsDouble(i+1,j+1,0,0);<br>&nbsp;&nbsp;<br>&nbsp;&nbsp;temp1=temp[7]+2*temp[8]+temp[9];temp1=temp1-temp[1]-temp[2]*2-temp[3];<br>&nbsp;&nbsp;temp2=temp[3]+2*temp[6]+temp[9];temp2=temp2-temp[1]-temp[4]*2-temp[7];
<br>&nbsp;&nbsp;sobelVal=fabs(temp1)+fabs(temp2);//grads</p>
<p>&nbsp;&nbsp;imgData-&gt;SetScalarComponentFromDouble(i,j,0,0,sobelVal);&nbsp;&nbsp;<br>&nbsp;}</p>
<p>......//the following code renders the processed object </p></div>