[vtk-developers] Building an image reader for series of volumes

Pelt, R.F.P. van R.F.P.v.Pelt at tue.nl
Thu Aug 9 02:50:49 EDT 2012


Hi,

I've recently started a little project to create an image reader for a specific type of medical image data (Philips PAR/REC).
Hopefully I can do this neatly in VTK style, but I'm not pleased with the approach I've taken so far.
I'd appreciate your take on this! Here's my idea so far.

vtkPARRECParser: to read the data properties. No troubles here
vtkPARRECReader: derives from vtkImageReader2

By default vtkImageReader is build to return a single slice or volume through the GetOutput function.
My data also deals with time series. The vtkDICOMReader deals with series of slices, by stacking them into a volume.
However, I'll have to deal with series of volumes.  So I thought: do not depair - there is the vtkTemporalDataSet.

In the reader I have
ExecuteInformation - parses the parameters
ExecuteData (vtkDataObject* out) - get the info from the rec file.

Ah, so 'out' is a generic container. So I can cast types:
if(singleTime)
{
  vtkImageData *data = this->AllocateOutputData(out);
  // go get the data
}
else
{
  vtkTemporalDataSet *data = vtkTemporalDataSet::New();
  // go get the data
  out->DeepCopy(data);
}

Seems plausible, although the deepcopy is surely not preferable. The main issue I have with this
is the way the data set is returned to the application. GetOutput returns a vtkImageData, this being
a child of the vtkImageReader. My initial thought was to return as a vtkObject:

vtkDataObject * GetOutput()
{
  return this->GetOutputDataObject(0);
}

However, this leaves it up to the application to decide to which type it should downcast.

This approach doesn't 'feel right'. What would you suggest to do to keep it in line with the VTK philisophy?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20120809/82061b86/attachment.html>


More information about the vtk-developers mailing list