[vtkusers]
vtkVolume ( vtkVolumeRayCastMapper ( vtkDICOMImageReader, ... )
) Seg Faults
Stewart Dickson
dickson at cs.unca.edu
Wed Jan 24 15:40:52 EST 2007
In Vtk version 4.4.0
vtkVolume (
vtkVolumeRayCastMapper ( vtkDICOMImageReader,
vtkVolumeRayCastCompositeFunction),
vtkVolumeProperty ( vtkPiecewiseFunction, vtkColorTransferFunction,
vtkPiecewiseFunction)
)
Produces a Segmentation fault as in the stack trace listed below.
I am using vtkDICOMImageReader SetDirectoryName
"DICOM/PAT00000/ST000000/SE000002"
where DICOM/PAT00000/ST000000/SE000002 contains MR0000[00-14]: DICOM
medical imaging data files.
Attached script is derived from
VolumeRendering/Testing/Tcl/volVPGradientOpacity.tcl
and Examples/VolumeRendering/Tcl/SimpleRayCast.tcl
At: http://www.vtk.org/doc/nightly/html/classvtkDICOMImageReader.html
it is written:
> ...the reader ... will select the subset corresponding to the first
> series UID it stumbles across and it will try to build an ordered
> volume from them based on the slice number. The volume building will
> be upgraded to something more sophisticated in the future.
I'm suspecting a bug in directory/string parsing in DICOMImageReader
Is there any way to help direct DICOMImageReader on how to get it right?
Thanks,
-Stewart Dickson, Lecturer, Department of Computer Science, UNC-Asheville
Research Associate, National Environmental Modeling and Analysis Center
http://www.unca.edu/nemac
Technical Director, http://us.imdb.com/Name?Stewart+Dickson
Sculptor, http://emsh.calarts.edu/~mathart/MathArt_siteMap.html
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xfffffff4
0x94b55014 in std::basic_stringbuf<char, std::char_traits<char>,
std::allocator<char> >::_M_sync ()
(gdb) where # we might ask...
#0 0x94b55014 in std::basic_stringbuf<char, std::char_traits<char>,
std::allocator<char> >::_M_sync ()
#1 0x02ff8320 in vtkOStrStreamWrapper::vtkOStrStreamWrapper ()
#2 0x029f50d0 in vtkDICOMImageReader::CanReadFile ()
#3 0x029f5658 in vtkDICOMImageReader::ExecuteInformation ()
#4 0x0303a514 in vtkSource::UpdateInformation ()
#5 0x02fac9ec in vtkDataObject::UpdateInformation ()
#6 0x0303a414 in vtkSource::UpdateInformation ()
#7 0x02fac9ec in vtkDataObject::UpdateInformation ()
#8 0x01aa66dc in vtkAbstractVolumeMapper::Update ()
#9 0x01aa6780 in vtkAbstractVolumeMapper::GetBounds ()
#10 0x01b05028 in vtkVolume::GetBounds ()
#11 0x01aee56c in vtkRenderer::ComputeVisiblePropBounds ()
#12 0x01aee7d8 in vtkRenderer::ResetCamera ()
#13 0x01aee230 in vtkRenderer::GetActiveCamera ()
#14 0x01ab68e0 in vtkFrustumCoverageCuller::Cull ()
#15 0x01aedd98 in vtkRenderer::AllocateTime ()
#16 0x01aed6d4 in vtkRenderer::Render ()
#17 0x01af0c2c in vtkRendererCollection::Render ()
#18 0x01aea498 in vtkRenderWindow::DoStereoRender ()
#19 0x01aea408 in vtkRenderWindow::DoFDRender ()
#20 0x01ae9fd0 in vtkRenderWindow::DoAARender ()
#21 0x01ae987c in vtkRenderWindow::Render ()
#22 0x01b31390 in vtkXOpenGLRenderWindow::Render ()
#23 0x01187ad0 in vtkXOpenGLRenderWindowCppCommand ()
#24 0x0a00c818 in TclInvokeStringCommand ()
#25 0x0a00de84 in TclEvalObjvInternal ()
#26 0x0a00f430 in Tcl_EvalEx ()
#27 0x0a04ac18 in Tcl_FSEvalFile ()
#28 0x0a04ad08 in Tcl_EvalFile ()
#29 0x0b01fc28 in Tk_MainEx ()
#30 0x000031d8 in main ()
Machine Model: PowerMac7,3
CPU Type: PowerPC G5 (3.1)
Number Of CPUs: 2
CPU Speed: 2.7 GHz
L2 Cache (per CPU): 512 KB
Memory: 2 GB
Bus Speed: 1.35 GHz
System Version: Mac OS X 10.4.8 (8L127)
Kernel Version: Darwin 8.8.0
-------------- next part --------------
package require vtk
package require vtkinteraction
vtkVersion version
puts -nonewline "Vtk version "
puts [version GetVTKVersion]
# Image pipeline
vtkDICOMImageReader reader
puts "DICOMImageReader DirectoryName /Users/dickson/SPD_Viz/Nate_MRI/DICOM/PAT00000/ST000000/SE000002"
# DICOMDIR points to
# DICOM/PAT00000/ST000000/SE000002/MR000000-MR00014
reader SetDirectoryName "/Users/dickson/SPD_Viz/Nate_MRI/DICOM/PAT00000/ST000000/SE000002"
# puts "creating vtkImageShiftScale"
# vtkImageShiftScale ss
# ss SetInput [reader GetOutput]
# ss SetOutputScalarTypeToUnsignedShort
# ss SetScale 256
puts "creating Piecewise opacity_transfer_function"
vtkPiecewiseFunction opacity_transfer_function
# opacity_transfer_function AddPoint 5120 0.0
opacity_transfer_function AddPoint 20 0.0
# opacity_transfer_function AddPoint 65280 0.2
opacity_transfer_function AddPoint 255 0.2
puts "creating ColorTransferFunction"
vtkColorTransferFunction color_transfer_function
color_transfer_function AddRGBPoint 0 0 0 0
color_transfer_function AddRGBPoint 64 1 0 0
color_transfer_function AddRGBPoint 128 0 0 1
color_transfer_function AddRGBPoint 192 0 1 0
color_transfer_function AddRGBPoint 255 0 .2 0
puts "creating gradient_opacity_function"
vtkPiecewiseFunction gradient_opacity_function
gradient_opacity_function AddPoint 0 0
gradient_opacity_function AddPoint 12 0
gradient_opacity_function AddPoint 25 1
gradient_opacity_function AddPoint 255 1
# puts "creating VolumeProMapper"
# vtkVolumeProMapper mapper
# mapper SetInput [ss GetOutput]
# mapper SetInput [reader GetOutput]
# mapper GradientOpacityModulationOn
puts "creating VolumeRayCastMapper"
vtkVolumeRayCastCompositeFunction compositeFunction
vtkVolumeRayCastMapper volumeMapper
volumeMapper SetVolumeRayCastFunction compositeFunction
volumeMapper SetInput [reader GetOutput]
puts "creating VolumeProperty"
vtkVolumeProperty volProp
volProp SetColor color_transfer_function
volProp SetScalarOpacity opacity_transfer_function
volProp SetGradientOpacity gradient_opacity_function
volProp ShadeOn
puts "creating Volume"
vtkVolume volume
volume SetMapper volumeMapper
volume SetProperty volProp
puts "creating Renderer"
vtkRenderer ren
ren AddVolume volume
# [ren GetActiveCamera] ParallelProjectionOn
# ren SetBackground 0.1 0.2 0.4
puts "creating RenderWindow"
vtkRenderWindow renWin
renWin AddRenderer ren
renWin SetSize 300 300
puts "creating RenderWindowInteractor"
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
iren AddObserver UserEvent {wm withdraw .}
renWin Render
# ren ResetCamera
proc TkCheckAbort {} {
set foo [renWin GetEventPending]
if {$foo != 0} {renWin SetAbortRender 1}
}
renWin AddObserver AbortCheckEvent {TkCheckAbort}
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
wm withdraw .
More information about the vtkusers
mailing list