[vtkusers] Generate Mesh - Finite Element Analysis

InfoSeekerr ali.mahmoud.habib at gmail.com
Sat Oct 24 07:45:12 EDT 2009


I tried your code , but I got the imagedata by reading dicom series of CT it
give error wich is :
vtktypeID can't load 17280129 element of size..........
Any advice please 

my code is:
			// 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();

			// set the imagedata 
			vtk::vtkImageData ^VoxelData = VIC->GetOutput();

			vtk::vtkMarchingCubes ^mcubes = gcnew vtk::vtkMarchingCubes();
			mcubes->GetOutput()->ReleaseDataFlagOff();
			mcubes->SetInput(VoxelData);
			mcubes->SetValue(0, 4);
			mcubes->ComputeGradientsOn();
			mcubes->Update();


			vtk::vtkSmoothPolyDataFilter ^smoother = gcnew
vtk::vtkSmoothPolyDataFilter();
			smoother->GetOutput()->ReleaseDataFlagOff();
			smoother->SetInput(mcubes->GetOutput());
			smoother->SetNumberOfIterations(5);
			smoother->SetRelaxationFactor(0.70);
			smoother->SetFeatureAngle(70);
			smoother->FeatureEdgeSmoothingOn();
			smoother->BoundarySmoothingOn();
			smoother->Update();

			vtk::vtkPolyDataNormals ^normals = gcnew vtk::vtkPolyDataNormals();
			normals->GetOutput()->ReleaseDataFlagOff();
			normals->SetInput(smoother->GetOutput());
			normals->SetFeatureAngle(80);
			normals->Update();

			vtk::vtkStripper ^stripper = gcnew vtk::vtkStripper();
			stripper->SetInput(normals->GetOutput());
			stripper->GetOutput()->ReleaseDataFlagOff();
			stripper->Update();



			vtkPolyDataMapper ^mapper = gcnew vtkPolyDataMapper();
			mapper->SetInput(stripper->GetOutput());

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


			// actor coordinates geometry, properties, transformation 
			vtkActor ^aSphere = gcnew vtkActor();
			aSphere->SetMapper(mapper);
			//aSphere.GetProperty().SetColor(0,0,1); // sphere color blue

			// a renderer and render window 
			vtkRenderer ^ren1 = gcnew vtkRenderer();
			vtkRenderWindow ^renWin = gcnew vtkRenderWindow();
			renWin->AddRenderer(ren1);

			// an interactor 
			vtkRenderWindowInteractor ^iren = gcnew vtkRenderWindowInteractor();
			iren->SetRenderWindow(renWin);

			// add the actor to the scene 
			ren1->AddActor(aSphere);
			//ren1.SetBackground(1,1,1); // Background color white

			// render an image (lights and cameras are created automatically) 
			renWin->Render();

			// begin mouse interaction 
			iren->Start();







Paul Jhin wrote:
> 
> Hi,
> 
> I'm trying to generate a mesh for export and analysis via finite element.
> 
> But the original mesh are very triangle.
> 
> If you apply the filter mesh decimação is a little deformed.
> 
> The Imagedata is generated from a CT 512x512 with 200 slices.
> 
> What can I doing wrong ?
> 
> 
> The Code:
> 
>         mcubes = vtk.vtkMarchingCubes()
>         mcubes.GetOutput().ReleaseDataFlagOff()
>         mcubes.SetInput(_imagedata)
>         mcubes.SetValue(0, 4)
>         mcubes.ComputeGradientsOn()
>         mcubes.Update()
> 
>         smoother = vtk.vtkSmoothPolyDataFilter()
>         smoother.GetOutput().ReleaseDataFlagOff()
>         smoother.SetInput(mcubes.GetOutput())
>         smoother.SetNumberOfIterations(5)
>         smoother.SetRelaxationFactor(0.70)
>         smoother.SetFeatureAngle(70)
>         smoother.FeatureEdgeSmoothingOn()
>         smoother.BoundarySmoothingOn()
>         smoother.Update()
> 
>         normals = vtk.vtkPolyDataNormals()
>         normals.GetOutput().ReleaseDataFlagOff()
>         normals.SetInput(smoother.GetOutput())
>         normals.SetFeatureAngle(80)
>         normals.Update()
> 
>         stripper = vtk.vtkStripper()
>         stripper.SetInput(normals.GetOutput())
>         stripper.GetOutput().ReleaseDataFlagOff()
>         stripper.Update()
> 
>         mesh =  normals.GetOutput()
> 
> 
> 
> Regards
> Paul Jhin
> 
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the 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/Generate-Mesh---Finite-Element-Analysis-tp21276802p26038264.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list