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

Raghavendra Chandrashekara rc3@doc.ic.ac.uk
Thu, 6 Mar 2003 10:57:13 -0000


This is a multi-part message in MIME format.

------=_NextPart_000_0057_01C2E3CF.24B87900
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

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.

----- Original Message -----
From: "Luis Ibanez" <luis.ibanez@kitware.com>
To: "Raghavendra Chandrashekara" <rc3@doc.ic.ac.uk>
Cc: <insight-users@public.kitware.com>
Sent: Wednesday, March 05, 2003 7:37 PM
Subject: Re: [Insight-users] Compiling ITK on Windows: PNG problems


>
> Hi Raghavendra
>
>
> Did you searched for a png.dll  ?
>
> Another possibility is that your png library is not
> being rebuilt...
>
> Have you tried with a clean build from scractch ?
>
> -------
>
> If you want to get around this and disable PNG
> you can modify the CMakeLists.txt files in the
> following directories:
>
>
> 1) Insight/Utilities/
>     (remove  "png" in the SUBDIRS command) that
>     will prevent png from being built
>
> 2) Insight/Code/IO
>     remove PNGImageIO and PNGImageIOFactory from
>     the list of sources.
>
>
> Note that this is not a "solution", just a desperate
> attempt to get around the real problem.
>
> PNG is build nightly and continuosly in all the
> platforms you see in the dashboard. So it is very
> likely that the problem is related configuration
> of your specific system.
>
>
>
>
>     Luis

------=_NextPart_000_0057_01C2E3CF.24B87900
Content-Type: text/plain;
	name="CMakeLists.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="CMakeLists.txt"

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)
------=_NextPart_000_0057_01C2E3CF.24B87900
Content-Type: text/plain;
	name="ITKGIPLImageTest.cxx"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ITKGIPLImageTest.cxx"

#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 !=3D 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 =3D ReaderType::New();
    WriterType::Pointer pWriter =3D 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;
}

------=_NextPart_000_0057_01C2E3CF.24B87900--