[Insight-users] Compiling ITK on Windows: GIPL problems

Luis Ibanez luis.ibanez@kitware.com
Thu, 06 Mar 2003 07:18:12 -0500


Hi Raghavendra,


Your code looks good, except for the line


         using namespace std;


Please DO NOT USE this lines in any code.
It is only calling for trouble. Your cout's
already have the "std::" as they should, so
you can get rid of the "using namespace".

------

I agree with Mathieu, in that the possible source
of the problem is the absence of a ".gipl" extension.

Please let us know if your files are using the right
extensions.

If the extensions happen to be correct, this may
indicate a problem with the Analyze image reader,
in which case we will track it down.



Thanks


Luis


-------------------------------


Raghavendra Chandrashekara wrote:
> Hi Luis,
> 
> Thanks for your help. I tried building everything from scratch (after
> removing any png.dll files on my system) but with no luck. I must be doing
> something wrong with the configuration. Well anyway I stopped the png
> library from being built as you suggested and managed to get the test
> program to build properly. Now when I run the program using the image in
> Testing/Data/Input/ramp.gipl as input an exception is produced and this is
> the error message I get:
> 
> Exception object caught!
> 
> itk::ExceptionObject (00DFF304)
> Location: "Unknown"
> File: \packages\InsightCVS\Code\IO\itkAnalyzeImageIO.cxx
> Line: 796
> Description: File cannot be read
> 
> Is this a possible bug? It seems strange that the Analyze image IO object is
> the one causing the exception and not the GIPL image IO. I've attached the
> source code.
> 
> Thanks,
> 
> Raghavendra.
> 

>>
>>
>>------------------------------------------------------------------------
>>
>>PROJECT(ITKGIPLImageTest)
>>
>>INCLUDE(${CMAKE_ROOT}/Modules/FindITK.cmake)
>>IF (USE_ITK_FILE)
>>	INCLUDE(${USE_ITK_FILE})
>>ENDIF (USE_ITK_FILE)
>>
>>ADD_EXECUTABLE(ITKGIPLImageTest ITKGIPLImageTest.cxx)
>>
>>IF (WIN32)
>>	TARGET_LINK_LIBRARIES(ITKGIPLImageTest ITKIO ITKCommon ITKMetaIO VXLNumerics)
>>ELSE (WIN32)
>>	TARGET_LINK_LIBRARIES(ITKGIPLImageTest ITKIO ITKCommon ITKMetaIO VXLNumerics dl pthread)
>>ENDIF (WIN32)
>>
>>
>>------------------------------------------------------------------------
>>
>>#include <iostream>
>>
>>using namespace std;
>>
>>#include "itkImage.h"
>>#include "itkImageFileReader.h"
>>#include "itkImageFileWriter.h"
>>
>>/* Program reads a GIPl image and writes it out again. */
>>int main(int argc, char** argv)
>>{
>>  if (argc != 3) {
>>    std::cout << "Usage: ITKGIPLImageTest input.gipl output.gipl" << std::endl;
>>    exit(1);
>>  }
>>
>>  typedef short PixelType;
>>  typedef itk::Image<PixelType, 3> ImageType;
>>  typedef itk::ImageFileReader<ImageType> ReaderType;
>>  typedef itk::ImageFileWriter<ImageType> WriterType;
>>
>>  try {
>>    ReaderType::Pointer pReader = ReaderType::New();
>>    WriterType::Pointer pWriter = WriterType::New();
>>
>>    pReader->SetFileName(argv[1]);
>>    pWriter->SetFileName(argv[2]);
>>
>>    pWriter->SetInput(pReader->GetOutput());
>>
>>    pWriter->Update();
>>  }
>>  catch (itk::ExceptionObject& ex) {
>>    std::cout << "Exception object caught!" << std::endl;
>>    std::cout << ex << std::endl;
>>    exit(1);
>>  }
>>
>>  return 0;
>>}
>