[vtkusers] vtkImagePlaneWidget, segmentation fault

Eric Pichon eric at ece.gatech.edu
Wed Oct 8 14:13:23 EDT 2003


On Wed, 8 Oct 2003, Mathieu Malaterre wrote:

> > Thanks Mathieu. The arrays are named so the problem must lie elsewhere.
> >
> > Here is a more detailed description of what I do. This is still a somwehat
> > stripped down version of the complete program but should really contain
> > everything you want ot know.
> >
> > If someone still wants more details I would be happy to send the complete
> > source tree along with the data...
> >
> > Again, the behaviour is the following: if my first user interaction with
> > the vtkPlaneImageWidget is to try to translate it (by moving the mouse
> > while holding the middle button) then the program crashes with a
> > segmentation fault.
> >
> > ddd says:
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x4031943a in vtable for vtkTimeStamp () from
> > /scratch/VTK/bin/libvtkCommon.so
> > at some point in the past, it also said that the problem was in
> > vtkFieldData::SetArray( int i )
> >
> > If instead I first rotate the plane slightly then everything goes fine and
> > I can later translate it as much as I want.
> >
> > If the vtkImageData is built with only one vtkFloatArray, i.e. if I
> > comment out:
> >
> > // pd->AddArray( fractionalAnisotropy );
> >
> > Then everything is also fine (the program never crashes).
> >
> > Details about the build environement are at the bottom of this message.
> >
> > I will be gratefull for any help or idea !
> >
>
> Eric,
>
> 	Next time, could you please include a *real* code with real #include or
> a simple python script. This allows us to quickly reproduce the bug.
>
> 	So find attached to this email a code I wrote based on your notes. I
> can reproduce a seg fault, only if I comment:
>
> //  pd->SetActiveScalars( "trace" );
>
> 	Otherwise I can do whatever I want: rotation, translation...
>
> Two suggestions:
> 	- Test this file, and report if it crash with you
> 	- Make sure it doesn't come from your data (I generated my own)

Mathieu,

Sorry about not providing you with a "real" program and thanks a lot for
your help and attention.

The program you attached DOES crash for me (exactly the same behaviour as
my original program) if the first operation on the vtkImagePlaneWidget is
a translation.

Attached are the output and my makefile (I don't think there is
anything special there but just in case...).

Again, this is with:

Red Hat Linux 9.0
g++ (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

and with the most recent VTK (CVS updated on Wed Oct  8 14:08:59 EDT
2003).

Thanks again,

Eric
-------------- next part --------------
# ----------------------------------------------------------------------------
#
# visuDTI - Makefile
#
# Eric Pichon, 2003
#
# ----------------------------------------------------------------------------

#--------------------------- Compiler and flags ------------------------------

CC            = gcc -g
CXX           = g++ -g
FLAGS         = -Wall -fPIC -Wno-deprecated

#-----------------------------------------------------------------------------

SOURCES = visuDTI.cpp visuDTIfunctions.cpp colorScales.cpp convert2dtivti.cpp convert2dtivtiFunctions.cpp testbug.cpp
OBJECTS = $(SOURCES:.cpp=.o)

# where is VTK installed, i.e. where are the libraries, and where is the VTK root directory
# with leading /

VTK_LIB_PATH = /scratch/VTK/bin/
VTK_INC_ROOT = /scratch/VTK/

# where is CParameters installed.
# with leading /

CPARAMETERS_LIB_PATH = /home/gte444x/projects/CParameters/
CPARAMETERS_INC_PATH = /home/gte444x/projects/CParameters/

# where the Gnu Scientific Librairy is
# with leading /

GSL_LIB_PATH = /scratch/gsl-1.4/lib/
GSL_INC_PATH = /scratch/gsl-1.4/


INCS =  -I ${VTK_INC_ROOT} -I ${VTK_INC_ROOT}Graphics \
	-I ${VTK_INC_ROOT}Rendering -I ${VTK_INC_ROOT}Common \
	-I ${VTK_INC_ROOT}Filtering -I ${VTK_INC_ROOT}Hybrid \
	-I ${VTK_INC_ROOT} -I ${VTK_INC_ROOT}Imaging \
	-I ${VTK_INC_ROOT}IO \
	-I $(CPARAMETERS_INC_PATH) \
	-I $(GSL_INC_PATH)

LIBS = -L.  -L/usr/local/lib -lm \
	-L${VTK_LIB_PATH} -lpthread -ldl -lGL -lvtkCommon -lvtkFiltering \
	-lvtkHybrid -lvtkImaging -lvtkGraphics -lvtkRendering  \
	-lnsl -lvtkpng -lvtkzlib -lvtkIO \
	-L$(CPARAMETERS_LIB_PATH) -lCParameters \
	-L$(GSL_LIB_PATH) -lgsl -lgslcblas

all:	visuDTI convert2dtivti testbug

testbug: testbug.o
	${CXX} ${FLAGS} testbug.o -o testbug ${LIBS}

convert2dtivti: convert2dtivti.o convert2dtivtiFunctions.o
	${CXX} ${FLAGS} convert2dtivti.o convert2dtivtiFunctions.o -o convert2dtivti ${LIBS}

visuDTI: visuDTI.o visuDTIfunctions.o colorScales.o 
	${CXX} ${FLAGS} visuDTI.o visuDTIfunctions.o colorScales.o -o visuDTI ${LIBS}

.cpp.o:
	${CXX} ${FLAGS} ${INCS} -c $<

clean:
	rm -f *.o core visuDTI *.d

%.d: 
	set -e; ${CXX} -MM ${FLAGS} ${INCS} $< \
                  | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
                [ -s $@ ] || rm -f $@

include $(SOURCES:.cpp=.d)
-------------- next part --------------
done
vtkImageData (0x8059cb8)
  Debug: Off
  Modified Time: 129
  Reference Count: 1
  Registered Events: (none)
  Source: 0x8059a88
  Release Data: Off
  Data Released: True
  Global Release Data: Off
  MaximumNumberOfPieces: -1
  PipelineMTime: 0
  UpdateTime: 0
  UpdateExtent: Not Initialized
  Update Number Of Pieces: 1
  Update Piece: 0
  Update Ghost Level: 0
  RequestExactExtent: Off
   UpdateExtent: 0, 0, 0, 0, 0, 0
  WholeExtent: 0, -1, 0, -1, 0, -1
  Field Data:
    Debug: Off
    Modified Time: 126
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 0
    Number Of Components: 0
    Number Of Tuples: 0
  Locality: 0
  NumberOfConsumers: 0
  ExtentTranslator: (0x8059e38)
  MaximumNumberOfPieces: -1
  Number Of Points: 0
  Number Of Cells: 0
  Cell Data:
    Debug: Off
    Modified Time: 128
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 0
    Number Of Components: 0
    Number Of Tuples: 0
    Copy Flags: ( 1 1 1 1 1 )
    Scalars: (none)
    Vectors: (none)
    Normals: (none)
    TCoords: (none)
    Tensors: (none)
  Point Data:
    Debug: Off
    Modified Time: 129
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 0
    Number Of Components: 0
    Number Of Tuples: 0
    Copy Flags: ( 1 1 1 1 1 )
    Scalars: (none)
    Vectors: (none)
    Normals: (none)
    TCoords: (none)
    Tensors: (none)
  Bounds:
    Xmin,Xmax: (1e+38, -1e+38)
    Ymin,Ymax: (1e+38, -1e+38)
    Zmin,Zmax: (1e+38, -1e+38)
  Compute Time: 0
  Release Data: Off
  ScalarType: 10
  NumberOfScalarComponents: 1
  Spacing: (1, 1, 1)
  Origin: (0, 0, 0)
  Dimensions: (0, 0, 0)
  Increments: (0, 0, 0)
  Extent: (0, -1, 0, -1, 0, -1)
  WholeExtent: (0, -1, 0, -1, 0, -1)

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 7505)]
0x080db1e7 in ?? ()
(gdb) 

The above log is suspicious so I uncommented 

data->Update();

before 

data->Print ( std::cout );

then I get the following output:
(the program still crashes)

done
vtkImageData (0x8059cb8)
  Debug: Off
  Modified Time: 184
  Reference Count: 1
  Registered Events: (none)
  Source: 0x8059a88
  Release Data: Off
  Data Released: False
  Global Release Data: Off
  MaximumNumberOfPieces: -1
  PipelineMTime: 129
  UpdateTime: 185
  UpdateExtent: Not Initialized
  Update Number Of Pieces: 1
  Update Piece: 0
  Update Ghost Level: 0
  RequestExactExtent: Off
   UpdateExtent: 0, 9, 0, 9, 0, 9
  WholeExtent: 0, 9, 0, 9, 0, 9
  Field Data:
    Debug: Off
    Modified Time: 173
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 0
    Number Of Components: 0
    Number Of Tuples: 0
  Locality: 0
  NumberOfConsumers: 0
  ExtentTranslator: (0x8059e38)
  MaximumNumberOfPieces: -1
  Number Of Points: 1000
  Number Of Cells: 729
  Cell Data:
    Debug: Off
    Modified Time: 175
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 0
    Number Of Components: 0
    Number Of Tuples: 0
    Copy Flags: ( 1 1 1 1 1 )
    Scalars: (none)
    Vectors: (none)
    Normals: (none)
    TCoords: (none)
    Tensors: (none)
  Point Data:
    Debug: Off
    Modified Time: 182
    Reference Count: 1
    Registered Events: (none)
    Number Of Arrays: 2
    Array 0 name = fractionalAnisotropy
    Array 1 name = trace
    Number Of Components: 2
    Number Of Tuples: 1000
    Copy Flags: ( 1 1 1 1 1 )
    Scalars: (none)
    Vectors: (none)
    Normals: (none)
    TCoords: (none)
    Tensors: (none)
  Bounds:
    Xmin,Xmax: (0, 9)
    Ymin,Ymax: (0, 9)
    Zmin,Zmax: (0, 9)
  Compute Time: 0
  Release Data: Off
  ScalarType: 10
  NumberOfScalarComponents: 1
  Spacing: (1, 1, 1)
  Origin: (0, 0, 0)
  Dimensions: (10, 10, 10)
  Increments: (1, 10, 100)
  Extent: (0, 9, 0, 9, 0, 9)
  WholeExtent: (0, 9, 0, 9, 0, 9)


More information about the vtkusers mailing list