[vtkusers] problem with vtkImageAppend / vtkImageClip

Madhusudhanan Balasubramanian madhu_lsu at yahoo.com
Wed Jul 21 10:25:53 EDT 2004


Hi all,
 
I've problem using vtkImageAppend with vtkImageClip in a small loop.  Here is my code fragment:
 
 extents = this->imageAppend->GetOutput()->GetExtent();
 for (tempIndex = 0; tempIndex < this->currZIndex; tempIndex++){
  extents[4] = tempIndex;
  extents[5] = tempIndex;
  vtkImageData *dispImgDataTrk = vtkImageData::New();
  clipImage(this->imageAppend->GetOutput(), extents, &(dispImgDataTrk));
  dim = dispImgDataTrk->GetDimensions();
  uscData = (unsigned char *)dispImgDataTrk->GetScalarPointer();
  convertUSCToFloatImageData(uscData, dim, &tempData);
  tempMat = (float *)tempData->GetScalarPointer();
  sum = sumMat(tempMat, dim);
  dispImgDataTrk->Delete();
  sprintf(testStr, "dim: %d, %d, %d, sum: %f", dim[0], dim[1], dim[2], sum);
  AfxMessageBox(testStr);
 }
 
Assuming the imageAppend already has a volume built, this code fragment, goes through the volume one slice at a time; I tried to print the sum of all the pixels to verify.  However, this code seems not to work.  Though the extents are changed while clipping, the output of vtkImageClip always returns the data stored in z = 0; Is there something I should do before I use vtkImageAppend in a loop like this?  
 
I've used document/view arch. in MFC to do this.  When I advance through the slice one at a time in the view (the vtkImageAppend is maintained in the doc.), it seems to have no problem.  When I access the same volume in a loop, like the one shown above, it always returns the z=0 level.
 
I appreciate any inputs on this.
 
Madhu.

		
---------------------------------
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040721/193c5f04/attachment.htm>


More information about the vtkusers mailing list