[vtkusers] vtkFloatArray Error - Help
Gururajan
gururajan.r at raster.in
Sat Aug 8 09:04:38 EDT 2009
Hi All,
Any one please guide me for the below bug. When i try execute my
application it is hitting me.
Please suggest where am doing mistake,. for ur reference i pasted my
code below.
ERROR: In /home/juju/VTK5.0/VTK/Common/vtkDataArrayTemplate.txx, line 255
vtkFloatArray (0x8a514b8): Unable to allocate 38395308 elements of size
4 bytes
setLayout(new BorderLayout());
System.out.println("Here the programm Starts");
vtkDICOMImageReader dicomreader = new vtkDICOMImageReader();
dicomreader .SetDirectoryName("/home/gururaj/MANIX/43a297f8");
dicomreader.Update();
vtkImageWriter writer = new vtkImageWriter();//
vtkImageWriter::New()
writer.SetInput(dicomreader.GetOutput());
writer.SetFilePrefix("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/Raw/");
writer.SetFilePattern("%s%3d.dcm.raw");
writer.Write();
writer.Update();
vtkVolume16Reader v16 = new vtkVolume16Reader();
v16.SetDataByteOrderToLittleEndian();
v16 .SetFilePrefix("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/Raw/");
v16.SetFilePattern("%s%3d.dcm.raw");
v16.SetImageRange(0,100);
v16.GetOutput().ReleaseDataFlagOn();
v16.SetDataSpacing(dicomreader.GetDataSpacing());
v16.SetDataDimensions(dicomreader.GetOutput().GetDimensions());
v16.Update();
vtkMarchingCubes surfaceExtractor = new vtkMarchingCubes();
surfaceExtractor.SetInput(v16.GetOutput());
surfaceExtractor.ComputeNormalsOn();
surfaceExtractor.ComputeGradientsOn();
surfaceExtractor.SetValue(0, 2500);
vtkDecimatePro deci = new vtkDecimatePro();
deci.SetInput(surfaceExtractor.GetOutput());
deci.SetTargetReduction(100);
deci.PreserveTopologyOn();
/* vtkImageGaussianSmooth GauSmooth = new vtkImageGaussianSmooth();
GauSmooth.SetInput(surfaceExtractor.GetOutput());
GauSmooth.SetDimensionality(3);
GauSmooth.SetStandardDeviation(0.0, 4.0);
*/
// vtkMarchingContourFilter skinExtractor = new
vtkMarchingContourFilter();
// skinExtractor.SetInput(surfaceExtractor.GetOutput());
// skinExtractor.SetValue(0,500);
// skinExtractor.Update();
vtkSmoothPolyDataFilter smoother = new vtkSmoothPolyDataFilter();
//smoother.SetInput(surfaceExtractor.GetOutput());
smoother.SetInput(deci.GetOutput());
smoother.Update();
smoother.SetNumberOfIterations(0);
vtkPolyDataNormals normals = new vtkPolyDataNormals();
normals.SetInput(smoother.GetOutput());
normals.FlipNormalsOn();
vtkPolyDataWriter pdw = new vtkPolyDataWriter();
pdw.SetInput(normals.GetOutput());
pdw .SetFileName("/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Dicom.vtk");
pdw.Write();
// 3d Construction
String strfilename = new String();
strfilename = "/home/gururaj/eclipse
Project/SimpleVTK/SimpleVtk/CardiacCT/Dicom.vtk";
vtkPolyDataReader polyReader = new vtkPolyDataReader();
polyReader.SetFileName(strfilename);
polyReader.Update();
vtkPolyData polyData = new vtkPolyData();
polyData.DeepCopy(polyReader.GetOutput());
vtkPolyDataMapper polyMapper = new vtkPolyDataMapper();
polyMapper.SetInput(polyData);
polyMapper.Update();
polyMapper.ScalarVisibilityOff();
//for skin and bone Diagram
//For setting Bone Colour
vtkGeometryFilter geovolumebone = new vtkGeometryFilter();
geovolumebone.SetInput(polyReader.GetOutput());
vtkPolyDataMapper geobonemapper = new vtkPolyDataMapper();
geobonemapper.SetInput(geovolumebone.GetOutput());
geobonemapper.ScalarVisibilityOff();
vtkLODActor boneActor = new vtkLODActor();
boneActor.SetNumberOfCloudPoints(100000);
boneActor.SetMapper(geobonemapper);
boneActor.GetProperty().SetColor(1,1,1);
boneActor.GetProperty().SetOpacity(5.0);
boneActor.GetProperty().SetDiffuse(0.75);
boneActor.GetProperty().SetSpecular(0.75);
//For setting Bone Colour
//For setting Skin Colour
vtkMarchingCubes skin = new vtkMarchingCubes();
skin.SetInput(v16.GetOutput());
skin.SetValue(0, 760);
skin.ComputeNormalsOn();
vtkGeometryFilter geovolumeSkin = new vtkGeometryFilter();
geovolumeSkin.SetInput(skin.GetOutput());
vtkPolyDataMapper skinmapper = new vtkPolyDataMapper();
skinmapper.SetInput(geovolumeSkin.GetOutput());
skinmapper.ScalarVisibilityOff();
vtkLODActor actorskin = new vtkLODActor();
actorskin.SetNumberOfCloudPoints(100000);
actorskin.SetMapper(skinmapper);
actorskin.GetProperty().SetColor( 1, 0.547237, 0.319073 );
//actorskin.GetProperty().SetColor( 100, 0, 0);
actorskin.GetProperty().SetOpacity( 1.3 );
//For setting Skin Colour
//for skin and bone Diagram
vtkGeometryFilter geovolumeskin = new vtkGeometryFilter();
vtkRenderer render = new vtkRenderer();
vtkRenderWindow renwindow = new vtkRenderWindow();
renwindow.AddRenderer(render);
vtkRenderWindowInteractor renintec = new
vtkRenderWindowInteractor();
renintec.SetRenderWindow(renwindow);
render.AddActor(boneActor);
render.SetBackground(0, 0, 0);
//render.AddLight(light);
renwindow.BordersOff();
renwindow.FullScreenOn();
renwindow.SetSize(500, 500);
renwindow.Render();
render.ResetCamera();
renintec.Start();
More information about the vtkusers
mailing list