[vtkusers] vtkImageAccumulate

Dean Inglis dean.inglis at camris.ca
Fri Oct 7 11:00:01 EDT 2005


Here is a pipeline that will do the job:

  vtkImageAccumulate* accum = vtkImageAccumulate::New();
  accum->SetComponentSpacing(1,0,0);
  accum->SetInput( input /* your vtkImageData */ );

  double range[2];
  input->GetScalarRange( range );
  accum->SetComponentExtent( 0 , static_cast<int>(range[1]-range[0]), 0, 0,
0, 0 );
  accum->SetComponentOrigin( static_cast<int>(range[0]), 0 , 0 );
  accum->UpdateWholeExtent();

  vtkXYPlotActor* plot = vtkXYPlotActor::New();
  plot->ExchangeAxesOff();
  plot->SetLabelFormat("%g");
  plot->SetXRange( accum->GetMin()[0], accum->GetMax()[0]) ;
  // or
  // plot->SetXRange( range) ;
  plot->AddInput( accum->GetOutput() );
  plot->SetXValuesToValue();

  You can do even more interesting things with regions of interest
  if you use a vtkImageStencil in your pipeline.
  you could also use a vtkImageThreshold on the input to look
  at histogram of soft tissue or hard tissue values only.

Dean


Hi all,

I am working with a CT dataset consisting of 93
slices. Probably you all have this dataset as it is
included in vtk Examples, it is simply the "headsq".

I need to make a histogram of the "skin" and "bone"
pixels to show how many pixels in the dataset
represent the skin and how many represent the bone.

I didn't know how to use "vtkImageAccumulate" to
accomplish this.

The reader is something like the following:

vtkVolume16Reader *v16 = vtkVolume16Reader::New();
    v16->SetDataDimensions (64,64);
    v16->SetImageRange (1,93);
    v16->SetDataByteOrderToLittleEndian();
    v16->SetFilePrefix (argv[1]);
    v16->SetDataSpacing (3.2, 3.2, 1.5);

It would be very appreciated if someone can help me or
give me some hints on how to use "vtkImageAccumulate"
with this dataset.

Thank you



__________________________________





More information about the vtkusers mailing list