[vtkusers] convert vtkimagetype to vtkpolydata or vtkunstructured

InfoSeekerr ali.mahmoud.habib at gmail.com
Fri Oct 23 20:57:44 EDT 2009


Hi all,

I am trying to use the following steps to create tetrahdral mesh as appear
in the photo ins this link :
http://www.iue.tuwien.ac.at/phd/fleischmann/img346.gif 

1. I read the 2D slices using vtkDICOMImageReader 
2. apply delaunry3D or vtkDataSetTriangleFilte for the vtkdicomimagereader
output.
3. defien iso value to render the skull 
4. create a volume and rendering it. 


there're two error appears , which are :
1.vtkstreamingdemandpibline error. 
2. vtkfixedpointvolumeraycastmapper error : No input.




I think the problem in use the output of vtkdicomimagereader in delaunary3d
any suggestion please 






the code is :



//Variables
			array<double> ^metaScalarRange = gcnew array<double>(2) { 0, 0 };
			vtk:: vtkRenderWindow renwM = gcnew vtk::vtkRenderWindow();

			vtk:: vtkRenderer ren1 = gcnew vtkRenderer();
			vtk:: vtkRenderWindowInteractor iren = gcnew
vtk::vtkRenderWindowInteractor();

			vtk:: vtkVolume volume = gcnew vtk::vtkVolume();
			renwM::AddRenderer(ren1);


			iren::SetRenderWindow(renwM);

			// Read a DICOM series path:

			vtk:: vtkDICOMImageReader VDR = gcnew vtk::vtkDICOMImageReader();
			VDR::SetDirectoryName("H:\\work\\Master
Degree\\DataSet\\case1-\\DICOM\\PA1\\ST1\\SE1");

			VDR::SetDataOrigin(0, 0, 0);

			VDR->Update();


			/////
			vtk:: vtkImageChangeInformation VIC = gcnew
vtk::vtkImageChangeInformation();

			VIC::SetInput(VDR::GetOutput());

			VIC::CenterImageOn();


			VIC->Update();

			///////// Applying the mesh

			vtkDataSetTriangleFilter ^VDST = gcnew vtkDataSetTriangleFilter();
			VDST->SetInputConnection(VDR::GetOutputPort());


//            
//            vtkDelaunay3D VDST = new vtkDelaunay3D();
//
//            VDST.SetInputConnection(VDR.GetOutputPort()); 

			// Load the data on vtkimagedata.

			vtk:: vtkImageData VoxelData = VIC::GetOutput();
			// Start adjust the rendering

			vtkVolumeProperty ^volumeProperty = gcnew vtkVolumeProperty();
			metaScalarRange = VoxelData::GetScalarRange();


			int isovalue = Convert::ToInt32(0.8 * (metaScalarRange[1] +
metaScalarRange[0]));
			/////////////////////////////////////////////

			array<double> ^inputRange = VoxelData::GetScalarRange();
			vtk:: vtkPiecewiseFunction opacityIsoTransferFunction = gcnew
vtk::vtkPiecewiseFunction();

			double per = ((inputRange[1] - inputRange[0]) / 100);
			if (isovalue > (inputRange[0] + per))

			{

				opacityIsoTransferFunction::AddPoint(inputRange[0], 0);


				opacityIsoTransferFunction::AddPoint(isovalue - (per), 0);

			}


			opacityIsoTransferFunction::AddPoint(isovalue, 1);

			opacityIsoTransferFunction::AddPoint(inputRange[1], 1);


			vtk:: vtkColorTransferFunction colorTransferFunction = gcnew
vtk::vtkColorTransferFunction();
			colorTransferFunction::AddRGBPoint(inputRange[0], 1.0, 1.0, 1.0);


			colorTransferFunction::AddRGBPoint(inputRange[1], 1.0, 1.0, 1.0);

			volumeProperty->SetColor(colorTransferFunction);


			volumeProperty->SetScalarOpacity(opacityIsoTransferFunction);

			volumeProperty->ShadeOn();


			volumeProperty->SetInterpolationTypeToLinear();

			volume::SetProperty(volumeProperty);


			///////////////////////////
			vtk:: vtkFixedPointVolumeRayCastMapper volumeMapper = gcnew
vtk::vtkFixedPointVolumeRayCastMapper();

			volumeMapper::SetInputConnection(VDST->GetOutputPort());

			volumeMapper::AutoAdjustSampleDistancesOn();


			volumeMapper->Update();

			volume::SetMapper(volumeMapper);


			volume->Update();

			//////////////////////////////////

			vtkActor ^actor = gcnew vtkActor();
			actor->GetProperty()->SetRepresentationToWireframe();


			ren1::AddVolume(volume);

			ren1::AddActor(actor);


			ren1::ResetCamera();

//            ren1.GetActiveCamera().Azimuth(0);
//            ren1.GetActiveCamera().Roll(0);


			ren1::GetActiveCamera()->Elevation(90);

			renwM::Render();


			iren->Initialize();
			iren::Enable();



best regards 

Bryn Lloyd-2 wrote:
> 
> 0)
> Please read this email carefully.
> 
> 1)
> You were told NOT to write to the developers list. Don't do it!
> 
> 2)
> STOP writing to people's private email addresses! Especially, when they 
> have asked you.
> 
> 3)
> You did NOT pay anybody to answer your questions. Don't expect to always 
> get one.
> 
> 4)
> Your questions are often impossible to understand. Spend more time on 
> writing a question, so that it is easy to understand. You will get 
> better answers in return!
> 
> 5)
> Nearly all VTK filter have either tests or examples (or both), which 
> explain how the filter/class can be used. This is visible on the doxygen 
> documentation. For instance vtkClipDataSet has tests:
> http://www.vtk.org/doc/nightly/html/classvtkClipDataSet.html
> 
> 
> 
> About you question:
> 
> you could try following pipeline:
> 
> reader
> -> marching cubes (e.g. vtkContourFilter) at a given iso-contour
> -> delaunay
> -> writer or do something
> 
> 
> alternatively, skipping the delaunay part:
> 
> reader
> -> clip volume (vtkClipDataSet) at a given iso-contour
> -> optional: clipping can produce prisms and other 3D cells. Convert 
> these to tetrahedra (vtkDataSetTriangleFilter).
> -> writer or do something
> 
> 
> 
> 
> 
> 
> Ali Habib wrote:
>> Dear all,
>> 
>> I want to convert the output of vtkDICOMImageReader to vtkpolydata or 
>> vtkunstructured grid , to be used with vtkdealunary3D
>> 
>> using vtkthreshold give an exption wish can''t load 33..element 
>> 
>> 
>> any suggestion
>> 
>> best regards 
>> 
>> 
>> ------------------------------------------------------------------------
>> 
>> _______________________________________________
>> 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
> 
> 
> -- 
> -------------------------------------------------
> Bryn Lloyd
> Computer Vision Laboratory
> ETH Zürich, Sternwartstrasse 7, ETF C110
> CH - 8092 Zürich, Switzerland
> Tel: +41 44 63 26668
> Fax: +41 44 63 21199
> -------------------------------------------------
> _______________________________________________
> 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
> 
> 

-- 
View this message in context: http://www.nabble.com/convert-vtkimagetype-to-vtkpolydata-or-vtkunstructured-tp25969808p26035173.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list