<html>
<body>
I am forwarding a copy of our discussion so far to the users
list.<br><br>
- Amy<br><br>
<br>
<blockquote type=cite class=cite cite>Vetria,<br><br>
I just noticed the you replied only to me and not the the vtkusers list.
Please keep the discussion on the list so other people can help if
necessary and so there is a record of the solution to this problem if
other people encounter the same thing.<br><br>
What kind of data are you trying to load? Depending on the type of your
data, you might want to try loading it using one of the subclasses of
vtkImageReader2. These readers can handle 3D data by reading in a series
of 2D slices.<br><br>
- Amy<br><br>
At 02:32 PM 4/5/2004, Vetria Byrd wrote:<br>
<blockquote type=cite class=cite cite><font face="arial" size=2 color="#000080">When
I try creating an instance of vtkVolume16Reader the code complies with no
errors but when I try to run it I get:<br>
<br>
ERROR: In C:\Program Files\vtk42\IO\vtkVolume16Reader.cxx, line 375<br>
vtkVolume16Reader (0x022B5400): Error reaading raw pgm data!<br>
<br>
So, I thought I would try vtkVolumeReader.<br>
<br>
Vetria<br>
<br>
</font><font face="tahoma" size=2>-----Original Message-----<br>
<b>From:</b> Amy Henderson
[<a href="mailto:amy.henderson@kitware.com" eudora="autourl">mailto:amy.henderson@kitware.com</a>]
<br>
<b>Sent:</b> Monday, April 05, 2004 12:14 PM<br>
<b>To:</b> byrdv@cis.uab.edu; 'Amy Henderson'<br>
<b>Subject:</b> RE: [vtkusers] vtkVolumeReader<br>
</font><font face="Times New Roman, Times"> <br>
Did you intend to create an instance of vtkVolume16Reader?
vtkVolumeReader has a pure virtual method, so you can't instantiate it;
you have to create an instance of one of its concrete subclasses (e.g.,
vtkVolume16Reader, which I see in your list of include files).<br><br>
- Amy<br><br>
At 01:08 PM 4/5/2004, Vetria Byrd wrote:<br><br>
</font><font face="arial" size=2 color="#000080">Yes.<br>
<br>
Here’s the entire file:<br>
<br>
//<br>
// This example reads a volume dataset, extracts an isosurface and
displays it.<br>
//<br>
<br>
#include "vtkRenderer.h"<br>
#include "vtkRenderWindow.h"<br>
#include "vtkRenderWindowInteractor.h"<br>
#include "vtkVolume16Reader.h"<br>
#include "vtkVolumeReader.h"<br>
#include "vtkObject.h"<br>
#include "vtkMarchingCubes.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"<br>
<br>
int main (int argc, char **argv)<br>
{<br>
if (argc < 2)<br>
{<br>
cout << "Usage: " <<
argv[0] << " DATADIR/cube/slice" << endl;<br>
return 1;<br>
}<br>
<br>
<br>
vtkRenderer *ren = vtkRenderer::New();<br>
vtkRenderWindow *renWin = vtkRenderWindow::New();<br>
renWin->AddRenderer(ren);<br>
vtkRenderWindowInteractor *iren =
vtkRenderWindowInteractor::New();<br>
iren->SetRenderWindow(renWin);<br>
<br>
*vtkVolumeReader *volReader = vtkVolumeReader::New();<br>
volReader->SetImageRange (1,5);<br>
volReader->SetFilePrefix (argv[1]);<br>
volReader->SetDataSpacing (1,1,1);<br>
volReader->Update();<br>
<br>
// An isosurface, or contour value of 1 is known to correspond to
the object. <br>
vtkMarchingCubes *iso =vtkMarchingCubes::New();<br>
iso->SetInput(volReader->GetOutput()
);<br>
iso->SetValue(0,1); <br>
<br>
vtkPolyDataMapper *isoMapper = vtkPolyDataMapper::New();<br>
isoMapper->SetInput(iso->GetOutput()
);<br>
isoMapper->ScalarVisibilityOff();<br>
<br>
vtkActor *isoActor = vtkActor::New();<br>
isoActor->SetMapper(isoMapper);<br>
<br>
vtkOutlineFilter *outline = vtkOutlineFilter::New();<br>
outline->SetInput( (vtkDataSet *)
volReader->GetOutput() );<br>
<br>
vtkPolyDataMapper *outlineMapper =
vtkPolyDataMapper::New();<br>
outlineMapper->SetInput(outline->GetOutput() );<br>
<br>
vtkActor *outlineActor = vtkActor::New();<br>
outlineActor->SetMapper(outlineMapper);<br>
outlineActor->VisibilityOff();<br>
<br>
//<br>
// Add the actors to the renderer, set the background and
size<br>
//<br>
ren->AddActor(outlineActor);<br>
ren->AddActor(isoActor);<br>
ren->SetBackground(0.2,0.3,0.4);<br>
renWin->SetSize(450,450);<br>
ren->GetActiveCamera()->Elevation(90);<br>
ren->GetActiveCamera()->SetViewUp(0,0,-1);<br>
<br>
iren->Initialize();<br>
<br>
// render the image<br>
iren->Start();<br>
<br>
<br>
return 0;<br>
}<br>
<br>
</font><font face="tahoma" size=2>-----Original Message-----<br>
<b>From:</b> Amy Henderson
[<a href="mailto:amy.henderson@kitware.com" eudora="autourl">mailto:amy.henderson@kitware.com</a>]
<br>
<b>Sent:</b> Monday, April 05, 2004 11:59 AM<br>
<b>To:</b> byrdv@cis.uab.edu; 'vtkusers'<br>
<b>Subject:</b> Re: [vtkusers] vtkVolumeReader<br>
</font> <br>
Vetria,<br><br>
Did you include the vtkVolumeReader header file (#include
"vtkVolumeReader.h")?<br><br>
- Amy<br><br>
At 12:47 PM 4/5/2004, Vetria Byrd wrote:<br><br>
<font face="arial" size=2>I have manually created data files that
consists of zero’s and one’s (no header info) to resemble a (5x5x5) 3D
cube.<br>
There are 5 data files. When I try to use vtkVolumeReader I get the
following error message:<br>
<br>
error C2440: 'initializing' : cannot convert from 'class vtkObject *' to
'class vtkVolumeReader *'<br>
Types pointed to are
unrelated; conversion requires reinterpret_cast, C-style cast or
function-style cast<br>
<br>
This is where the error occurs:<br>
:<br>
:<br>
<br>
vtkVolumeReader *volReader = vtkVolumeReader::New();<br>
volReader->SetImageRange (1,5);<br>
volReader->SetFilePrefix (argv[1]);<br>
volReader->SetDataSpacing (1,1,1);<br>
volReader->Update();<br>
<br>
Any assistance will be greatly appreciated.<br>
Thanks,<br>
_______________<br>
Vetria L. Byrd<br>
</font> <br>
</blockquote></blockquote></body>
</html>