[vtkusers] Can any body help!

Engr. Saira Saleem Pathan sarakhan_engr at hotmail.com
Mon Apr 23 15:02:22 EDT 2007


hi
thanks both of u
well, the technique work and there is not error on compile time, but when i 
m running it will take too much time and generate "segmentation fault". 
well, the same data i can see using ImageSlice.cxx example of vtk.

Now:Following Error is Coming
ERROR: In /usr/not-backed-up/VTK/Rendering/vtkVolume.cxx, line 560
vtkVolume (0xa0c76c0): Unsupported data type

terminate called after throwing an instance of 'std::bad_alloc'
  what():  St9bad_alloc
Aborted


can u please tell me what wrong here in the code:

vtkImageShiftScale *imageShiftScale = vtkImageShiftScale ::New();
  imageShiftScale->SetInput(reader->GetOutput());
  imageShiftScale->SetOutputScalarTypeToShort();
  //imageShiftScale->SetShift(0);
  //imageShiftScale->SetScale(1);


vtkImageResample *resample = vtkImageResample::New();
resample->SetInput(imageShiftScale->GetOutput());
resample->SetAxisMagnificationFactor(0, 7.63);
resample->SetAxisMagnificationFactor(1, 7.63);
resample->SetAxisMagnificationFactor(2, 7.5);
resample-> Update();

vtkImageChangeInformation *cInfor =vtkImageChangeInformation::New();
cInfor->SetInput(resample->GetOutput());
cInfor->SetOutputSpacing(4.6875, 4.6875, 15);
cInfor->Update();

//# Create transfer mapping scalar value to opacity
vtkPiecewiseFunction *opacityTFunc = vtkPiecewiseFunction::New();
  opacityTFunc->AddPoint(20,0.0);
  opacityTFunc->AddPoint(255,0.2);

//# Create transfer mapping scalar value to color
vtkColorTransferFunction *colorTFunc = vtkColorTransferFunction::New();
  colorTFunc->AddRGBPoint(0.0,0.0,0.0,0.0);
  colorTFunc->AddRGBPoint(64.0,1.0,0.0,0.0);
  colorTFunc->AddRGBPoint(128,0.0,0.0,1.0);
  colorTFunc->AddRGBPoint(255,0.0,0.2,0.0);

//  Create the property for Volume
   vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
   volumeProperty->SetColor(colorTFunc);
   volumeProperty->SetScalarOpacity(opacityTFunc);
   volumeProperty->ShadeOn();
   volumeProperty->SetInterpolationTypeToLinear();


   //Create the objects specific to 2D texture mapping
   vtkVolumeTextureMapper2D *volumeMapper= vtkVolumeTextureMapper2D::New();
   volumeMapper->SetInput(cInfor->GetOutput());

   //create the Volume
   vtkVolume *volume = vtkVolume ::New();
   volume->SetMapper(volumeMapper);
   volume->SetProperty(volumeProperty);
   renderer->AddProp(volume);


  vtkRenderWindow *window = vtkRenderWindow::New();

  window->AddRenderer(renderer);



<html><DIV>
<P><STRONG><FONT color=#0000ff>Saira Saleem Pathan</FONT></STRONG><IMG 
height=2 src="http://graphics.hotmail.com/greypixel.gif" width="100%" 
vspace=9></P>
<P>Lecturer, Ph.D. Scholar</P>
<P>Department of Computer System and Software 
Engineering&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Merhan 
Univeristy of Engineering and Technology, 
Pakistan.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</P>
<P>Contact: cell : 92-0333&nbsp;2265249, office 92-022-2772250 ext(4215)</P>
<P>Email: <A 
href="mailto:sarakhanengr at gmail.com">sarakhanengr at gmail.com</A>, <A 
href="mailto:saira99cs07 at yahoo.com">saira99cs07 at yahoo.com</A></P>
<P>&nbsp;</P>
<P>&nbsp;</P></DIV></html>





>From: Marc Cotran <marc at cotran.ca>
>To: "Engr. Saira Saleem Pathan" <sarakhan_engr at hotmail.com>
>CC: vtkusers at vtk.org
>Subject: Re: [vtkusers] Can any body help!
>Date: Mon, 23 Apr 2007 14:18:01 -0400
>
>Hi Saira,
>
>This is a common problem, and you can most likely find other threads on the 
>mailing list for it.
>
>You have two options here. One is to use a mapper that supports the short 
>data type (eg. vtkFixedPointMaper) and pass your data as is. The other is 
>change the data's scalar type and then use the ray cast mapper. To change 
>the scalar type without compromising the range of your data, take a look at 
>vtkImageShiftScale.
>
>Marc
>
>Engr. Saira Saleem Pathan wrote:
>>hi
>>I m writing a code and i can read Dicom data series and i want to apply 
>>Volume Rendering on that data which i READ.
>>the following error is coming.
>>
>>ERROR: In /usr/not-backed-up/VTK/Rendering/vtkVolumeRayCastMapper.cxx, 
>>line 325
>>vtkOpenGLVolumeRayCastMapper (0x894b6f0): Cannot volume render data of 
>>type short, only unsigned char or unsigned short.
>>
>>thanks
>>
>>_________________________________________________________________
>>FREE pop-up blocking with the new MSN Toolbar - get it now! 
>>http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
>>
>>_______________________________________________
>>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
>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




More information about the vtkusers mailing list