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