[vtkusers] Sobel effect on image in buffer

cspl affable at hd2.dot.net.in
Thu Aug 22 06:28:11 EDT 2002


Dear Friends,

I am facing problem with sobelimagefilter while using buffer.I got the o/p using files.But I am using buffer I got exception.
I am not export the buffer.I have written code as follows.Please give me suggesttion.
I got exception at export.


Volume* CIPServerDoc::SobelEffect(Volume *vol)
{

 if(vol==NULL)
 {
  AfxMessageBox("volume is null");
  return vol;
 }

 unsigned float *temp = new unsigned float[vol->width * vol->height * vol->depth];
 temp = (unsigned float *) vol->Mem;
 
 vtkImageImport *importer = vtkImageImport::New();
 importer->SetDataExtent(1,vol->width,1,vol->height,1,vol->depth);
 importer->SetWholeExtent(1,vol->width,1,vol->height,1,vol->depth);
 importer->SetDataScalarTypeToFloat();
 importer->SetImportVoidPointer(temp);
 
 AfxMessageBox("after image import");
 vtkImageSobel3D *sobel=vtkImageSobel3D::New();
 sobel->SetInput(importer->GetOutput());
 sobel->ReleaseDataFlagOff();
 
 AfxMessageBox("after sobel"); 

 vtkImageExport *Exporter = vtkImageExport::New();
 Exporter->SetInput(sobel->GetOutput());
 Exporter->Export(temp);                //got exception
 
 AfxMessageBox("before assign");
 vol->Mem  =temp;
 return vol;

}

Regards,
Ramakrishna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20020822/1897e7e5/attachment.htm>


More information about the vtkusers mailing list