[vtkusers] vtkFixedPointVolumeRayCastMapper Problem in java
sercani
sercanimailgroups at gmail.com
Tue Apr 27 04:30:51 EDT 2010
27.04.2010 11:10, Stef_D yazmış:
>
> Sercani wrote:
>
>> Hi everyone;
>>
>> I am using vtk java wrapping for MIP ... 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'm quoting your post as i've the exact same problem as you. I can bring
> news pieces as i spent many time on this problem without success :
> - It does work prefectly on OSX 10.6.3 (so with osx adapted compilation)
> - It does work with a pure win64 version (64 bits JVM with 64 bits VTK
> compilation) but the 64 bits VTK version brings some others problems.
> - It does not work with win32 version which is a shame as it's probably the
> most used version. I tried many VTK version (nighty, 5.4.2, 5.0... ) with
> many JVM version and always got the same result as soon i try to use the
> vtkFixedPointVolumeRayCastMapper with volume rendering. I need it as it's
> the only mapper which actually support multi component volume rendering.
>
> Someone else experienced this problem ? Can it be fixed or is it a bug in
> VTK library ?
> I don't understand why only the win32 port is affected (maybe other 32 bits
> ports but i didn't tested)...
> Thanks in advance for any help !
>
> Cheers.
>
Hi;
I couldn't solve this problem, but you can of course use
vtkVolumeRayCastMapper for maximum intensity(or minimum intensity)
projection, here is an example:
int scalarRangeMin = reader.GetOutput().GetScalarRange()[0];
int scalarRangeMax = reader.GetOutput().GetScalarRange()[1];
int window = (int) (scalarRangeMax - scalarRangeMin);
int level = (int) (scalarRangeMin + (window / 2));
vtkImageShiftScale shiftscale = new vtkImageShiftScale();
shiftscale.SetInputConnection(reader.GetOutputPort());
shiftscale.SetOutputScalarTypeToUnsignedShort();
if (scalarRangeMin < 0) {
shiftscale.SetShift(-1 * scalarRangeMin);
}
shiftscale.Update();
vtkPiecewiseFunction opacityFunction=new vtkPiecewiseFunction();
opacityFunction.AddPoint(scalarRangeMin, 0.0);
opacityFunction.AddPoint((level + window / 2), 1.0);
opacityFunction.AddPoint((level - window / 2), 0.0);
opacityFunction.AddPoint(scalarRangeMax, 0.0);
vtkPiecewiseFunction grayFunction = new vtkPiecewiseFunction();
grayFunction.AddSegment(0, 0.0, 255, 1.0);
volumeProperty.SetColor(grayFunction);
volumeProperty.SetScalarOpacity(opacityFunction);
volumeProperty.SetInterpolationTypeToLinear();
volumeProperty.ShadeOff();
vtkVolumeRayCastMIPFunction mipFunction = new vtkVolumeRayCastMIPFunction();
raycastMapper.SetInputConnection(shiftscale.GetOutputPort());
raycastMapper.SetBlendModeToMaximumIntensity();
raycastMapper.SetVolumeRayCastFunction(mipFunction);
raycastMapper.ReleaseDataFlagOn();
vtkVolume volume=new vtkVolume();
volume.SetMapper(raycastMapper);
volume.SetProperty(volumeProperty);
this.getRenderer().AddVolume(volume);
this.getRenderer().ResetCamera();
More information about the vtkusers
mailing list