[Insight-users] Grafting a C++ array onto a VectorImage filter output
Ramón Casero Cañas
rcasero at gmail.com
Mon Jun 4 08:47:38 EDT 2012
Hi all,
Grafting a C++ array (in this case from Matlab) onto a normal 128x128
image is
quite straightforward. First we allocate memory for the array
mxArray *p = (mxArray *)mxCreateNumericArray(ndim,
dims,
mxUINT8_CLASS,
mxREAL);
Later we get a pointer to this array
// pointer to the Matlab output buffer
uint8_T *imOutp = (uint8_T *)mxGetData(p);
and graft it onto the ITK filter output
const bool filterWillDeleteTheBuffer = false;
this->filter->GetOutput(0)->GetPixelContainer()
->SetImportPointer(imOutp,
128*128,
filterWillDeleteTheBuffer);
But how can this be done if the output of the filter is a VectorImage,
e.g. the third output of the DanielssonDistanceMapImageFilter?
Best regards,
Ramon.
--
Dr. Ramón Casero Cañas
Computational Biology
Department of Computer Science
University of Oxford
Wolfson Building, Parks Rd
Oxford OX1 3QD
tlf +44 (0) 1865 610737
web http://www.cs.ox.ac.uk/people/Ramon.CaseroCanas
photos http://www.flickr.com/photos/rcasero/
More information about the Insight-users
mailing list