[vtkusers] vtkImageImport

Erik Türke tuerke at cbs.mpg.de
Mon Mar 29 14:26:27 EDT 2010


On 03/29/2010 07:52 PM, David Gobbi wrote:
> Hi Erik,
>
> Can't you just do viewer->SetInput(importer->GetOutput ())?   You
> shouldn't have to do anything directly with the image data.  Once the
> importer has updated, the image data should directly use the memory at
> the void pointer that you provided.  Nothing else should be necessary.
>
>     David
>
>
> On Mon, Mar 29, 2010 at 11:18 AM, Erik Türke<tuerke at cbs.mpg.de>  wrote:
>    
>> Ahh very thanks....visualization is working now (at least slice-wise). I
>> guess 3d rendering is a bit more complicated.
>>
>> So the problem which remains is the storage in a vtkImageData object.
>> My approach is:
>>
>> vtkImage->SetDimensions(dimensions[0],
>>                  dimensions[1],
>>                  dimensions[2]);
>> vtkImage->SetWholeExtent(0,dimensions[0]-1,0,dimensions[1]-1,0,dimensions[2]-1);
>>
>> vtkImage->SetSpacing(1,1,1);
>> vtkImage->SetNumberOfScalarComponents(1);
>> vtkImage->SetOrigin(0,0,0);
>> vtkImage->AllocateScalars();
>> short* scalarPtr = static_cast<short*>(vtkImage->GetScalarPointer());
>> scalarPtr =&myAdapter->m_ImageISIS->voxel<short>(0,0,0,0);
>> vtkImage->Update();
>>
>> But if i hand the vtkImage to the viewer by:
>>
>> viewer->SetInput(vtkImage);
>>
>> the shown image is black :-(
>>      
Hi!

Well, this should be part of an adapter...so the user should get a list 
of pointers to vtkImageData objects (i return a list since the adapter 
also gets 4d data as input).
But it seems, this is not possible, so i have to return a list of 
pointers to vtkImageImport objects, what imho is a little odd for the 
user of the adapter.

cheers






More information about the vtkusers mailing list