[vtkusers] Reading from memory as opposed to file

dfcsingh at sri.utoronto.ca dfcsingh at sri.utoronto.ca
Mon Mar 24 11:41:13 EDT 2014


Hi,

Thanks so much for the help. This seems to have worked well. However I
mispoke on a rather important detail in my first e-mail. My vector of
doubles is in fact a vector of complex<double> values. How does vtk handle
this?
I'm prototyping my image manipulations in matlab and have guaranteed that
the vector contains the same data as the array I'm using in matlab.
However when I visualize each of these data sets I get different visuals
(attached).
Can vtk handle the c++ complex data type or is this a GIGO situation
because I'm feeding the vtk modules a complex vector?

Thanks for any help,
David

p.s. Sorry for the follow up questions, please let me know if I should
repost under a new subject line

> Hi David,
>
> Use vtkImageImport.  It has an interface that is nearly identical to
> vtkImageReader2, except that instead of having a SetFileName()
> method, it has a SetImportVoidPointer() method.
>
> So if your vector is named "data", do something like this:
>
> importer->SetImportVoidPointer(&data[0]);
> importer->SetDataScalarTypeToDouble();
> importer->SetDataExtent(0, 255, 0, 255, 0, 0);
> etcetera.
>
>   David
>
> On Fri, Mar 21, 2014 at 6:27 PM,  <dfcsingh at sri.utoronto.ca> wrote:
>>
>> Hi vtkusers,
>>
>> In my experience with vtk thus far I've used vtkImageReader2 to read
>> various MR file types and display them. For my next project I need to
>> visualize raw MR data. To this end I would like to do some
>> pre-processing
>> on the data before passing it to a vtk pipeline. At the end of the
>> processing in c++ I have a vector of doubles. Is there a way to feed
>> this
>> vector to vtkImageReader2 (or something similar)?
>> My google-fu yielded setmemorybuffer however I'm not sure how to pass
>> this
>> function a vector and more importantly it wasn't showing up as a member
>> of
>> vtkImageReader2 when I attempted to test it (using vtk 5.6.1)
>> I'd appreciate any help,
>> David
>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkPostFFT.JPG
Type: image/jpeg
Size: 23993 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140324/27f120f7/attachment-0002.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkPreFFT.JPG
Type: image/jpeg
Size: 22602 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140324/27f120f7/attachment-0003.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matlabPostFFT.jpg
Type: image/jpeg
Size: 6051 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140324/27f120f7/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matlabPreFFT.jpg
Type: image/jpeg
Size: 13141 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140324/27f120f7/attachment-0003.jpg>


More information about the vtkusers mailing list