[vtkusers] Volume subtraction : vtkImageData connection problem.

Alfredo Gourbish the.answer3 at libertysurf.fr
Thu Jul 5 16:07:38 EDT 2007


Hi all,

I have connection problem using vtkImageData.
First I will present you what I want to do. I work on a projet which constructs a 4-D volume from a MRI sequence. One of my goals is to substract 2 volumes. As I don't find an implemented function to do that in VTK, I try to access to the voxels of a volume. So I find that the vtkImageData class allows to access the data.
So I just tried to write this line "imageData = imageCast->GetOutput();" in my code and I have this error while executing the program :
"ERROR: In .\vtkDemandDrivenPipeline.cxx, line 799
vtkStreamingDemandDrivenPipeline (04FE70A8): Input for connection index 0 on input port index 0 for algorithm vtkVolumeRayCastMapper(04FD14B8) is NULL, but a vtkImageData is required."


Here an abstract of the code :

 vtkImageData * imageData = vtkImageData::New(); // with or without "New" the problem appears

...

 /// read a vtkVolume file ///
 structuredPointReader->ReleaseDataFlagOn();
 structuredPointReader->SetReleaseDataFlag( true );
 structuredPointReader->SetFileName( fileName );
 structuredPointReader->Update();

 imageCast->SetNumberOfThreads( 4 );
 imageCast->SetInputConnection( structuredPointReader->GetOutputPort() );
 imageCast->SetOutputScalarTypeToUnsignedChar();

 imageData = imageCast->GetOutput();
 /////////////////////////////

...

 /// MIP raycast ///
 volumeRayCastMapper->SetVolumeRayCastFunction( MIPfunction );
 volumeRayCastMapper->ReleaseDataFlagOn();

 volumeRayCastMapper->SetInput( this->imageCast->GetOutput() );
 //volumeRayCastMapper->SetInput( this->imageData ); // this line is commented in order to find the error when using imageData

 m_lastVolumeCreated->SetMapper( volumeRayCastMapper );
 m_lastVolumeCreated->SetProperty( this->volumeProperty );
 /////////////////////////////
...


So finally I have two questions :
- Why is there a connection problem in this code ?
- Is it the goo way to substract 2 volumes ?


Does somebody has any idea ?


Thank's in advance. ;-)


Gourbish.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070705/c48c8499/attachment.htm>


More information about the vtkusers mailing list