<div>hi to all..</div>
<div> </div>
<div>i'am haviing problem in in reading tha data from the specified location....The program is compling properly,but while run time is show the followinf error:</div>
<div> </div>
<div>1) ERROR: In C:\martink\vtk42\VTK\IO\vtkVolume16Reader.cxx, line 334<br>vtkVolume16Reader (0x055F0D80): Can't find file: c:/VTK_DATA_ROOT/Data/headsq/quarter.1
<p>2) ERROR: In C:\martink\vtk42\VTK\Graphics\vtkPolyDataNormals.cxx, line 88<br>vtkPolyDataNormals (0x055F2128): No data to generate normals for!</p>
<p>I have tried using \ / \\ // but result is same....</p>
<p>I'am using Visual studio 6.0 as IDE.... the following is my code...</p>
<p><br>// This example reads a volume dataset, extracts an isosurface that<br>// represents the skin and displays it.<br></p>
<p>#include "vtkRenderer.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkVolume16Reader.h"<br>#include "vtkPolyDataMapper.h"<br>
#include "vtkActor.h"<br>#include "vtkOutlineFilter.h"<br>#include "vtkCamera.h"<br>#include "vtkProperty.h"<br>#include "vtkPolyDataNormals.h"<br>#include "vtkContourFilter.h
"</p>
<p>int main ()<br>{<br> </p>
<p> // Create the renderer, the render window, and the interactor. The renderer<br> // draws into the render window, the interactor enables mouse- and <br> // keyboard-based interaction with the data within the render window.
<br> //<br> vtkRenderer *aRenderer = vtkRenderer::New();<br> vtkRenderWindow *renWin = vtkRenderWindow::New();<br> renWin->AddRenderer(aRenderer);<br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
<br> iren->SetRenderWindow(renWin);</p>
<p> // The following reader is used to read a series of 2D slices (images)<br> // that compose the volume. The slice dimensions are set, and the<br> // pixel spacing. The data Endianness must also be specified. The reader
<br> // usese the FilePrefix in combination with the slice number to construct<br> // filenames using the format FilePrefix.%d. (In this case the FilePrefix<br> // is the root name of the file: quarter.)<br> vtkVolume16Reader *v16 = vtkVolume16Reader::New();
<br> v16->SetDataDimensions (512,512);<br> v16->SetImageRange (1,40);<br> v16->SetDataByteOrderToLittleEndian();<br> v16->SetFilePrefix("c:/VTK_DATA_ROOT/Data/headsq/quarter");<br> v16->SetDataSpacing (
3.2, 3.2, 1.5);</p>
<p> // An isosurface, or contour value of 500 is known to correspond to the<br> // skin of the patient. Once generated, a vtkPolyDataNormals filter is<br> // is used to create normals for smooth surface shading during rendering.
<br> vtkContourFilter *skinExtractor = vtkContourFilter::New();<br> skinExtractor->SetInput((vtkDataSet *) v16->GetOutput());<br> skinExtractor->SetValue(0, 500);<br> vtkPolyDataNormals *skinNormals = vtkPolyDataNormals::New();
<br> skinNormals->SetInput(skinExtractor->GetOutput());<br> skinNormals->SetFeatureAngle(60.0);<br> vtkPolyDataMapper *skinMapper = vtkPolyDataMapper::New();<br> skinMapper->SetInput(skinNormals->GetOutput());
<br> skinMapper->ScalarVisibilityOff();<br> vtkActor *skin = vtkActor::New();<br> skin->SetMapper(skinMapper);</p>
<p> // An outline provides context around the data.<br> //<br> vtkOutlineFilter *outlineData = vtkOutlineFilter::New();<br> outlineData->SetInput((vtkDataSet *) v16->GetOutput());<br> vtkPolyDataMapper *mapOutline = vtkPolyDataMapper::New();
<br> mapOutline->SetInput(outlineData->GetOutput());<br> vtkActor *outline = vtkActor::New();<br> outline->SetMapper(mapOutline);<br> outline->GetProperty()->SetColor(0,0,0);</p>
<p> // It is convenient to create an initial view of the data. The FocalPoint<br> // and Position form a vector direction. Later on (ResetCamera() method)<br> // this vector is used to position the camera to look at the data in
<br> // this direction.<br> vtkCamera *aCamera = vtkCamera::New();<br> aCamera->SetViewUp (0, 0, -1);<br> aCamera->SetPosition (0, 1, 0);<br> aCamera->SetFocalPoint (0, 0, 0);<br> aCamera->ComputeViewPlaneNormal();
</p>
<p> // 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> aRenderer->AddActor(outline);<br>
aRenderer->AddActor(skin);<br> aRenderer->SetActiveCamera(aCamera);<br> aRenderer->ResetCamera ();<br> aCamera->Dolly(1.5);</p>
<p> // Set a background color for the renderer and set the size of the<br> // render window (expressed in pixels).<br> aRenderer->SetBackground(1,1,1);<br> renWin->SetSize(640, 480);</p>
<p> // 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> aRenderer->ResetCameraClippingRange ();
</p>
<p> // Initialize the event loop and then start it.<br> iren->Initialize();<br> iren->Start(); </p>
<p> // It is important to delete all objects created previously to prevent<br> // memory leaks. In this case, since the program is on its way to<br> // exiting, it is not so important. But in applications it is<br> // essential.
<br> v16->Delete();<br> skinExtractor->Delete();<br> skinNormals->Delete();<br> skinMapper->Delete();<br> skin->Delete();<br> outlineData->Delete();<br> mapOutline->Delete();<br> outline->Delete();
<br> aCamera->Delete();<br> iren->Delete();<br> renWin->Delete();<br> aRenderer->Delete();</p>
<p> return 0;<br>}<br></p>
<p>Please anyone can hel me out....????</p>
<p> </p>
<p><br> </p></div>