[ITK-users] ITK3.20.2 Crashes - Help!
Khojaste, Amir
amir.khojaste at sunnybrook.ca
Wed Apr 29 12:35:54 EDT 2015
Hi guys,
I am running the simplest piece of code using ITK3.20.2 libraries. In my program I simply want to read an image and do some processing on it and then save it. When I try to instantiate a pointer to my ImageFileReader the program crashes with the following message:
Unhandled exception at 0x000000013fbcf0b1 in HelloWorld.exe: 0xC0000005: Access violation reading location 0x00000000bfdef6f5.
It seems to be a memory leak error or something. I have used ITK3.20.2, CMake 2.8.10.2 and Visual Studio 2008 to configure my project. Following please find my code and my CMakelists.txt:
/* Code ===========================================================================================*/
#include "itkImage.h"
#include <iostream>
#include "itkImageFileWriter.h"
#include "itkImageFileReader.h"
#include "itkCropImageFilter.h"
#include "itksys/SystemTools.hxx"
const unsigned int ImageDimensions = 3;
typedef itk::Vector<signed short, 1> VectorType;
typedef itk::Image<VectorType, ImageDimensions> ImageType;
typedef itk::Image<VectorType, 2 > ImageType2D;
typedef itk::ImageFileReader<ImageType> ReaderType;
int main(int argc, char* argv[])
{
ImageType::Pointer image = ImageType::New(); //--- This line seem to be OK!
ReaderType::Pointer reader = ReaderType::New(); //--This line will crash!
system("pause");
return EXIT_SUCCESS;
}
/* CMakelists.txt ===========================================================================================*/
# This is the root ITK CMakeLists file.
cmake_minimum_required(VERSION 2.4)
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0003 NEW)
endif()
# This project is designed to be built outside the Insight source tree.
project(HelloWorld)
# Find ITK.
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
add_executable(HelloWorld HelloWorld.cxx )
target_link_libraries(HelloWorld ${ITK_LIBRARIES})
I have tried this using Visual Studio 2013, ITK 4.7 and CMake 3.1.3 and it ran just fine! But here it doesn't!
Any Idea on what might be the cause of problem? I am confused ...
Thanks,
Amir
This e-mail is intended only for the named recipient(s) and may contain confidential, personal and/or health information (information which may be subject to legal restrictions on use, retention and/or disclosure). No waiver of confidence is intended by virtue of communication via the internet. Any review or distribution by anyone other than the person(s) for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and destroy all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150429/39437b70/attachment.html>
More information about the Insight-users
mailing list