[vtkusers] vtkFixedPointVolumeRayCastMapper Problem in java
Sercani
sercanimailgroups at gmail.com
Mon Mar 23 08:20:46 EDT 2009
Hi everyone;
I am using vtk java wrapping for MIP(maximum intensity
projection)/MINIP(minimum intensity projection).I figured out that
vtkVolumeRayCastMapper doesn't support minip so decided to use
vtkFixedPointRayCastMapper for these projections.First I wrote in C++ and
everything works great.But in java(exactly the same code but in java syntax
of course) it always crashes when rendering the vtkPanel first time and
gives this stack overflow exception:
An unrecoverable stack overflow has occurred.
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x50aee7e7, pid=3268,
tid=5264
#
# Java VM: Java HotSpot(TM) Client VM (11.0-b16 mixed mode windows-x86)
# Problematic frame:
# C [vtkVolumeRendering.dll+0x4fe7e7]
#
I change my JVM's heap space( netbeans_default_options="-J-client
-J-Xverify:none -J-Xss2m -J-Xms200m -J-XX:PermSize=32m
-J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true
-J-Dsun.java2d.noddraw=true" it's minimum was 32m before the changing,
should i change the J-XX:PermSize=32m too? ) but it couldn't do the trick.I
think this bug is related to my problem :
http://www.vtk.org/Bug/view.php?id=6443 and i patched my vtk source code
with the patch that Levap attaches, but nothing changes.How can i use
vtkFixedPointRayCastMapper with my java project? This is my testing code in
c++, i tried every possible combinations with vtkImageCast output or reader
output, this code works but in java it always crashes.
Yours sincerely.
Sercan.
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkPolyDataToImageStencil.h"
#include "vtkImageData.h"
#include "vtkDICOMImageReader.h"
#include "vtkImageCast.h"
#include "vtkFixedPointVolumeRayCastMapper.h"
#include "vtkVolumeRayCastMapper.h"
#include "vtkVolumeRayCastMIPFunction.h"
#include "vtkPiecewiseFunction.h"
#include "vtkVolumeProperty.h"
#include "vtkVolume.h"
#include "vtkTextactor.h"
#include "Math.h"
#include <string>
#include <iostream>
#include <sstream>
class test
{
public:
test();
};
test::test()
{
vtkDICOMImageReader *reader= vtkDICOMImageReader::New();
reader->SetDirectoryName("C:\\Dicom\\MANIX\\manix-study\\ANGIOCT");
reader->SetDataScalarTypeToUnsignedChar();
reader->Update();
vtkImageCast *imageCast=vtkImageCast::New();
imageCast->SetInputConnection(reader->GetOutputPort());
imageCast->SetOutputScalarTypeToUnsignedChar();
imageCast->Update();
double *range=imageCast->GetOutput()->GetScalarRange();
double window=range[1]-range[0];
double level=window/2;
window=1500;
level=20;
vtkPiecewiseFunction
*opacityFunction=vtkPiecewiseFunction::New();
opacityFunction->AddPoint(level-window/2.0,0.0);
opacityFunction->AddPoint(level+window/2.0,1.0);
vtkPiecewiseFunction
*grayFunction=vtkPiecewiseFunction::New();
grayFunction->AddSegment(level - window / 2,0.0,level +
window / 2 , 1.0);
vtkFixedPointVolumeRayCastMapper
*raycastMapper=vtkFixedPointVolumeRayCastMapper::New();
//vtkVolumeRayCastMIPFunction
*mipFunction=vtkVolumeRayCastMIPFunction::New();
//mipFunction->SetMaximizeMethodToScalarValue();
//vtkVolumeRayCastMapper
*raycastMapper=vtkVolumeRayCastMapper::New();
raycastMapper->SetInputConnection(imageCast->GetOutputPort());
raycastMapper->SetSampleDistance(1.0);
//raycastMapper->SetVolumeRayCastFunction(mipFunction);
raycastMapper->SetBlendModeToMaximumIntensity();
raycastMapper->ReleaseDataFlagOn();
vtkVolumeProperty
*volumeProperty=vtkVolumeProperty::New();
volumeProperty->SetScalarOpacity(opacityFunction);
volumeProperty->SetColor(grayFunction);
volumeProperty->SetInterpolationTypeToLinear();
volumeProperty->ShadeOff();
volumeProperty->SetIndependentComponents(0);
/*volumeProperty->SetSpecularPower(10);
volumeProperty->SetSpecular(1.0);
volumeProperty->SetAmbient(1.0);
volumeProperty->SetDiffuse(1.0);*/
vtkVolume *volume=vtkVolume::New();
volume->SetMapper(raycastMapper);
volume->SetProperty(volumeProperty);
volume->Update();
vtkRenderer *aRenderer = vtkRenderer::New();
aRenderer->AddActor(volume);
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(aRenderer);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
// aRenderer->ResetCamera();
//aRenderer->ResetCameraClippingRange();
aRenderer->Render();
aRenderer->SetBackground(0.5,0.5,0.5);
renWin->SetSize(512, 512);
// interact with data
iren->Initialize();
iren->Start();
}
int main()
{
test t;
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090323/b7463864/attachment.htm>
More information about the vtkusers
mailing list