[vtkusers] vtkImageData Beginner Question

Michael Jackson mike.jackson at bluequartz.net
Fri Jul 3 18:39:11 EDT 2009


Thanks for the reply but I don't think something is correct. Using my  
numbers as an example can you tell me what I need to be setting each  
item to in the vtkImageData object?

setExtents?
setSpacing?
setOrigin?


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



On Jul 3, 2009, at 6:13 PM, Francois Bertel wrote:

> Hello,
>
> I think you should use SetExtent(), not SetDimensions().
>
> because the code of vtkImageData::SetDimensions() is actually:
>
>  SetExtent(0, dim[0]-1, 0, dim[1]-1, 0, dim[2]-1);
>
> Also Origin is the position in world coordinate of the point of
> extent(0,0,0): the origin does not have to be part of the dataset, in
> other words, the dataset extent does not have to start at (0,0,0) and
> the origin can be outside of the dataset bounding box.
>
>
> On Fri, Jul 3, 2009 at 5:50 PM, Michael
> Jackson<mike.jackson at bluequartz.net> wrote:
>> 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
>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>
>
>
> -- 
> François Bertel, PhD  | Kitware Inc. Suite 204
> 1 (518) 371 3971 x113 | 28 Corporate Drive
>                      | Clifton Park NY 12065, USA
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list