[vtkusers] vtkImageImport

David Gobbi david.gobbi at gmail.com
Mon Mar 29 13:52:44 EDT 2010


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 :-(



More information about the vtkusers mailing list