I try to construct a 3D Volume with slices, with Java.<br><br>First I copied the Medical1 Example (VTK example), which uses vtkVolume16Reader, but I use 1bit bmp image, and it doesn't read them (only 16bit pnm raw).<br><br>
Then I tried vtkVolumeReader, but I can't specify that it's a littleEndian (the MaskData doesn't exists)<br><br>So I used vtkImageReader, but it always crashes java and it neverd ends readind HDD, also for just 1 picture.
<br><br>Finally I use vtkImageReader2, but he says : <br><br>Warning: In /home/kevredon/stage/vtk/VTK/IO/vtkImageReader2.cxx, line 605<br>vtkImageReader2 (0x808f1a8): File operation failed.<br><br>Generic Warning: In /home/kevredon/stage/vtk/VTK/IO/vtkImageReader2.cxx, line 675
<br>File operation failed. row = 16, Read = 512, FilePos = -1<br><br>and construct the 3D volume juste partially.<br><br>What can I do now (or how specify that it's 1bit bmp) :<br><a href="mailto:kevredon@gmail.com">kevredon@gmail.com
</a><br><br>source :<br><br>//Create the buttons.<br> vtkPanel renWin = new vtkPanel();<br> <br> //image reader<br> vtkImageReader2 reader = new vtkImageReader2();<br>
reader.SetNumberOfScalarComponents(1);<br> reader.SetDataByteOrderToLittleEndian();<br> reader.SetDataOrigin(0, 0, 0);<br> reader.SetDataExtent(0,size[0]-1,0,size[1]-1,0,slices.length-1);<br>
reader.SetFilePrefix(FOLDER_NAME+File.separator+PREFIX);<br> reader.SetDataSpacing(spacing);<br><br> // An isosurface<br> vtkContourFilter skinExtractor = new vtkContourFilter();
<br> skinExtractor.SetInput(reader.GetOutput());<br> skinExtractor.SetValue(0,5);<br> vtkPolyDataNormals skinNormals = new vtkPolyDataNormals();<br> skinNormals.SetInput(skinExtractor.GetOutput
());<br> skinNormals.SetFeatureAngle(60.0);<br> vtkPolyDataMapper skinMapper = new vtkPolyDataMapper();<br> skinMapper.SetInput(skinNormals.GetOutput());<br> skinMapper.ScalarVisibilityOff
();<br> vtkActor skin = new vtkActor();<br> skin.SetMapper(skinMapper);<br><br> // An outline provides context around the data.<br> vtkOutlineFilter outlineData = new vtkOutlineFilter();
<br> outlineData.SetInput(reader.GetOutput());<br> vtkPolyDataMapper mapOutline = new vtkPolyDataMapper();<br> mapOutline.SetInput(outlineData.GetOutput());<br> vtkActor outline = new vtkActor();
<br> outline.SetMapper(mapOutline);<br> outline.GetProperty().SetColor(0, 0, 0);<br><br> // It is convenient to create an initial view of the data.<br> vtkCamera aCamera = new vtkCamera();
<br> aCamera.SetViewUp(0, 0, -1);<br> aCamera.SetPosition(0, 1, 0);<br> aCamera.SetFocalPoint(0, 0, 0);<br> aCamera.ComputeViewPlaneNormal();<br><br> // Actors are added to the renderer. An initial camera view is created.
<br> // The Dolly() method moves the camera towards the FocalPoint,<br> // thereby enlarging the image.<br> renWin.GetRenderer().AddActor(outline);<br> renWin.GetRenderer().AddActor(skin);
<br> renWin.GetRenderer().SetActiveCamera(aCamera);<br> renWin.GetRenderer().ResetCamera();<br> aCamera.Dolly(1.5);<br><br> // Set a background color for the renderer and set the size of the
<br> // render window (expressed in pixels).<br> renWin.GetRenderer().SetBackground(1, 1, 1);<br> VtkPanelUtil.setSize(renWin, 320, 240);<br><br> // Note that when camera movement occurs (as it does in the Dolly()
<br> // method), the clipping planes often need adjusting. Clipping planes<br> // consist of two planes: near and far along the view direction. The<br> // near plane clips out objects in front of the plane the far plane
<br> // clips out objects behind the plane. This way only what is drawn<br> // between the planes is actually rendered.<br> renWin.GetRenderer().ResetCameraClippingRange();<br><br>