[vtkusers] vtkImageData Beginner Question

Michael Jackson mike.jackson at bluequartz.net
Fri Jul 3 17:50:11 EDT 2009


I have consulted all the vtk and paraview books but I am just coming  
up empty on this.

Here is what I have: A volume of Grayscale pixels being read from a  
file. The data represents a volume starting at 46979 Microns in x and  
48443 Microns in Y. Each Slice in the z direction represents 1.2  
microns. The "scaling" is 0.207987 Microns/Pixel. The volume is  
roughly 821 slices by about 1500 Microns in X and about 1500 Microns  
in Y.

   Here is what I would like: This to show in a window (ParaView) so  
that when I set the "Show Axis" all the values are "correct", ie, the  
values should start at about 46979,48443,0 and go to their maximum  
values. Currently I have the user fill in some text fields that  
represent the VOI that the user would like to render. When the code  
hits what I have written I either get a crash or errors of the type:

ERROR: In /Users/Shared/Kitware-CVS/ParaView3/VTK/Filtering/ 
vtkImageData.cxx, line 2101
vtkImageData (0x122a31b70): GetPointer: Pixel (46979, 48443, 0) not in  
current extent: (0, 7432, 0, 7393, 0, 1)

or

Warning: In /Users/Shared/Kitware-CVS/ParaView3/VTK/Filtering/ 
vtkDataSet.cxx, line 414
vtkImageData (0x12a0e5ee0): Point array RoboMet Voxels with 1  
components, has 0 tuples but there are only -1048158596 points


Here is the code that I am using to init the vtkImageData object  
during the pipeline excution:

int dims[3];
dims[0] = (requestedExtent[1] - requestedExtent[0])/this- 
 >CurrentScalingFactor;
dims[1] = (requestedExtent[3] - requestedExtent[2])/this- 
 >CurrentScalingFactor;
dims[2] =  requestedExtent[5] - requestedExtent[4] + 1;
if (dims[2] == 0)
{
dims[2] = 1;
}
output->SetDimensions(dims[0], dims[1], dims[2]);
output->SetSpacing(this->DataSpacing);
output->SetOrigin(this->DataOrigin);
output->SetScalarType(VTK_TYPE_UINT8);

//output->SetExtent(requestedExtent);
output->SetNumberOfScalarComponents( 1 );
output->AllocateScalars();
output->GetPointData()->GetScalars()->SetName("RoboMet Voxels");
output->GetPointData()->SetActiveScalars("RoboMet Voxels");

Here is the values of the requestedExtent when the method gets called:

46979 48525 48443 49981 0 0

Any help is appreciated..
_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio






More information about the vtkusers mailing list