[vtkusers] Re: Problems with vtkImageImport

Prename Surname bsd.diverse at gmail.com
Sat Oct 21 04:37:53 EDT 2006


Is there not anyone who has been porting  data from matlab to vtk?
I could really use a little help on this one.
Thank you


2006/10/20, Prename Surname <bsd.diverse at gmail.com>:
>
> If i try to call
> long memSize=img->GetActualMemorySize();
> on my assigned image, it also returns 0. So somehow the data is not read
> into my object...Which i dont understand.
> Does anyone know about this problem?
> Thank you
>
>
> 2006/10/20, Prename Surname <bsd.diverse at gmail.com>:
> >
> > Hello all.
> > I hope i am not asking to many questions, but these import things gives
> > me a lot of problems.
> > I  have managed to get the mex-file to work, so now i can from matlab
> > interface to vtk, via a dll file.
> >
> > But i have problems converting the input-data(which is a C-array) to a
> > VTKImage.
> >
> > The problem is that when i try to access the data stored in my img
> > pointer, it seems to be empty.
> >
> > It is as if the data has not been put there.
> > I know that the variable double *data1=mxGetPr(prhs[0]);
> > contains the correct data. I have checked that.
> >
> > So am i missing something in the import filter?
> > I hope someone can help me out a little.
> >
> > Thank you very much
> >
> >
> > The code i have is as follows :
> >
> > void mexFunction(int nlhs, mxArray *plhs[], int nrhs,
> >                  const mxArray *prhs[])
> > {
> >  int m=mxGetM(prhs[0]);
> >  int n=mxGetN(prhs[0]);
> >  const int* dims=mxGetDimensions(prhs[0]);
> >  int num=mxGetNumberOfDimensions(prhs[0]);
> >  double *data1=mxGetPr(prhs[0]);
> >
> >  vtkImageImport *importer = vtkImageImport::New();
> >  importer->SetWholeExtent(1,dims[0],1,dims[1],1,dims[2]);
> >  importer->SetDataExtentToWholeExtent();
> >  importer->SetDataScalarTypeToShort();
> >  importer->SetImportVoidPointer(data1);
> >
> >  importer->Update();
> >  vtkImageData *img = importer->GetOutput();<---This data seems to be
> > empty...Why?
> >
> >  //mexPrintf("Data inserted");
> >  importer->Delete();
> >
> > }
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061021/d9168836/attachment.htm>


More information about the vtkusers mailing list