[Insight-users] installation problem with Borland compiler
Luis Ibanez
luis.ibanez at kitware.com
Thu Sep 14 14:30:36 EDT 2006
Hi Jean-Francois
PNG does not supports "short" pixel types.
You should use "unsigned char" or "unsighed short".
It is still strange that you are not getting an exception.
The error should be caught as an exception.
Have you tried your compiler with minimal code
that throws exceptions ?
Something like:
#include <iostream>
int main()
{
try
{
std::exception tt;
throw tt;
}
catch( std::exception & excp )
{
std::cout << "Exception caught" << std::endl;
std::cout << excp.what() << std::endl;
return 1;
}
std::cout << "No exception" << std::endl;
return 0;
}
Please let us know what you find.
Thanks
Luis
================================
Jean-Francois goudou wrote:
> Hi Luis,
>
> The last test I made :
> I created a new project, like HelloWorld, with only the file
> ImageReadWrite.cxx (and the CMakeList.txt from HelloWorld and modified):
>
>
> #***********************************************************
> #if defined(_MSC_VER)
> #pragma warning ( disable : 4786 )
> #endif
>
> #ifdef __BORLANDC__
> #define ITK_LEAN_AND_MEAN
> #endif
>
> #include "itkImageFileReader.h"
> #include "itkImageFileWriter.h"
> #include "itkImage.h"
> #include "stdio.h"
>
>
> int main( int argc, char ** argv )
> {
> if( argc < 3 )
> {
> std::cerr << "Usage: " << std::endl;
> std::cerr << argv[0] << " inputImageFile outputImageFile " <<
> std::endl;
> return EXIT_FAILURE;
> }
>
> typedef short PixelType;
> const unsigned int Dimension = 2;
> typedef itk::Image< PixelType, Dimension > ImageType;
> typedef itk::ImageFileReader< ImageType > ReaderType;
> typedef itk::ImageFileWriter< ImageType > WriterType;
>
> ReaderType::Pointer reader = ReaderType::New();
> WriterType::Pointer writer = WriterType::New();
>
> const char * inputFilename = argv[1];
> const char * outputFilename = argv[2];
>
> reader->SetFileName( inputFilename );
> writer->SetFileName( outputFilename );
>
> writer->SetInput( reader->GetOutput() );
>
> std::cout << "1" << std::endl;
>
> try
> {
> std::cout << "2" << std::endl;
> writer->Update();
> }
> catch( itk::ExceptionObject & err )
> {
> std::cout << "3" << std::endl;
> std::cerr << "ExceptionObject caught !" << std::endl;
> std::cerr << err << std::endl;
> return EXIT_FAILURE;
> }
>
> std::cout << "4" << std::endl;
> return EXIT_SUCCESS;
> }
> #*********************************************************
>
> The compilation was ok
> The test : ImageReadWrite Brain.png toto.png gave me the result :
>
> 1
> 2
> and then a Windows error window : this application has encoutered a
> problem and must close, etc.
> I fear to risk me in the ITKImageFileWriter files...
>
> Jeff
>
>
>
>
More information about the Insight-users
mailing list