[vtkusers] 3 Component RGB Data Volume Visualization

Brian Rowe briprowe at yahoo.com
Thu Jul 1 09:32:46 EDT 2004


Hello,
I have a set of data that is composed of 24bit RGB images.  I am trying 
to load them in as a volume and process them with ITK, then visualize 
them in VTK.

I can load them in ITK and pass them to vtk fine,  I verified this by 
loading a single image and passing it to vtkImageMapper (etc.).

The problem comes when I try to pass the volume to the vtkVolume 
classes (Mapper, Property, etc.)  When I visualize this, I see nothing. 
  I am not sure what the problem is.  It could be as simple as having 
inappropriate ColorTransferFunctions, but at this point I'd like to ask 
one of the experts if they see something.

I thank you for your time.

the relevant source code follows:
	append = vtkImageAppendComponents::New();
	
	//////////////////////////////////
	/// This code ties ITK to VTK
	//////////////////////////////////
	append->AddInput(RedConnector->GetOutput());
	append->AddInput(GreenConnector->GetOutput());
	append->AddInput(BlueConnector->GetOutput());
	//append->AddInput(AlphaConnector->GetOutput());
	
	/////////////////////////////////
	/// 2D Image Stuff
//	vtkImageMapper *imapper = vtkImageMapper::New();
//	
//	imapper->SetInput(append->GetOutput());
//	
//	vtkActor2D *actor = vtkActor2D::New();
//	actor->SetMapper(imapper);
//	ren->AddActor(actor);
     ///////////////////////////////////
	
	
	func = vtkVolumeRayCastCompositeFunction::New();
	
	mapper = vtkVolumeRayCastMapper::New();
	mapper->SetInput(append->GetOutput());
	mapper->IndependentComponentsOn();
	mapper->SetComponentBlendModeToAdd();
	mapper->SetVolumeRayCastFunction(func);
	
	opacity = vtkPiecewiseFunction::New();
//	opacity->AddPoint(0.0, 0);
//	opacity->AddPoint(5.0, 1);
	
	red = vtkColorTransferFunction::New();
	red->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
	red->AddRGBPoint(255.0, 1.0, 0.0, 0.0);
	green = vtkColorTransferFunction::New();
	green->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
	green->AddRGBPoint(255.0, 0.0, 1.0, 0.0);
	blue = vtkColorTransferFunction::New();
	blue->AddRGBPoint(0.0, 0.0, 0.0, 0.0);
	blue->AddRGBPoint(255.0, 0.0, 0.0, 1.0);
	
	prop = vtkVolumeProperty::New();
	prop->SetInterpolationTypeToLinear();
//	prop->SetScalarOpacity(0, opacity);
	prop->SetColor(0, red);
	prop->SetColor(1, green);
	prop->SetColor(2, blue);
	prop->ShadeOn();
	
	vol = vtkVolume::New();
	vol->SetProperty(prop);
	vol->SetMapper(mapper);

	ren->AddVolume(vol);
	ren->ResetCamera();

---
1.79 x 10^12 furlongs per fortnight -- it's not just a good idea, it's 
the law!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 5851 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040701/f6081d96/attachment.bin>


More information about the vtkusers mailing list