[Insight-users] ITK-3.18 ImageReadDicomSeriesWrite example crashes in GDCMImageIO::Write()

John Drescher drescherjm at gmail.com
Tue May 11 17:46:06 EDT 2010


I have found that the ImageReadDicomSeriesWrite  example crashes in
ITK-3.18.0. The cause is setting the DirectionCosines at line 1997 of
itkGDCMImageIO.cxx will cause a crash when m_Direction is a 2 by 2
vector which happens when the output image is 2D.

1995 :	 	 	  image.SetDirectionCosines(0,m_Direction[0][0]);
1996 :	 	 	  image.SetDirectionCosines(1,m_Direction[0][1]);
1997 :	 	 	  image.SetDirectionCosines(2,m_Direction[0][2]);
1998 :	 	 	  image.SetDirectionCosines(3,m_Direction[1][0]);
1999 :	 	 	  image.SetDirectionCosines(4,m_Direction[1][1]);
2000 :	 	 	  image.SetDirectionCosines(5,m_Direction[1][2]);


http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkGDCMImageIO.cxx?view=annotate&root=Insight&sortby=date

One example file I used to test this is the vtk example
VTKData\Data\HeadMRVolume.mhd


-- 
John M. Drescher
-------------- next part --------------
PROJECT(ImageReadWriteSeries)
cmake_minimum_required(VERSION 2.6)

IF(WIN32)
    SET(CMAKE_CXX_FLAGS "/WL /MP /GR /EHsc" )
    SET(CMAKE_EXE_LINKER_FLAGS "/INCREMENTAL:NO /MANIFEST /STACK:10000000 /machine:I386 /LARGEADDRESSAWARE")
	
	#-----------------------------------------------------------------------------
	# Disable deprecation warnings for standard C and STL functions in VS2005
	# and later
	IF(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400)
	  ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
	  ADD_DEFINITIONS(-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) 
	ENDIF(MSVC_VERSION EQUAL 1400 OR MSVC_VERSION GREATER 1400) 

ENDIF(WIN32)

IF(COMMAND cmake_policy)
  cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

SET (LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all libraries.")
SET (EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")

FIND_PACKAGE( ITK REQUIRED )
INCLUDE( ${ITK_USE_FILE} )

SET( ${PROJECT_NAME}_SRCS
	./main.cxx
)

SET( ${PROJECT_NAME}_HDRS
)

LINK_LIBRARIES ( ${PROJECT_NAME} ITKCommon ITKBasicFilters ITKIO 
)

ADD_EXECUTABLE( ${PROJECT_NAME} ${${PROJECT_NAME}_SRCS} ${${PROJECT_NAME}_HDRS} 
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cxx
Type: application/octet-stream
Size: 4595 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100511/3bec82cc/attachment.obj>


More information about the Insight-users mailing list