[Insight-users] Including MINC2.0 IO support in ITK

Mark Bouts mark at invivonmr.uu.nl
Wed Jan 10 10:45:24 EST 2007


Thnx this seems to work!

However when I try to rebuilt the toolkit. The involving files don't 
seem to be included in the built.
Strange thing is that I don't seem to be able to do a make from my 
binary directory after configuration with ccmake.
I don't understand why this is going wrong. Anybody a suggestion?
I consider it to be no option to copy the Makefile from the source 
directory to the binary directory and adjust the binary direction, for 
the other dependencies remain unchanged.
This leads to a normal build without the MINC2.0 files, which I want to 
be included

I think missing out on something simple, but seem to overlook what.
Can anyone help me?
Richard Beare wrote:
> Hi,
>
> I had some success under linux a while back. I can't remember the
> details, but I've attached the files I changed.
>
> On 1/10/07, Mark Bouts <mark at invivonmr.uu.nl> wrote:
>> Hi Insight-Users,
>>
>> I have a question regarding linking corresponding libraries for MINC2.0
>> in ITK.
>>
>> I'm trying to link the corresponding libraries netcdf, hdf5 and minc2
>> into the CMakeLists.txt file of the /Code/IO directory. However, I don't
>> have a clue on how to do this.
>> I have tried some options, but do not seem to succeed in doing the
>> correct thing.
>>
>> More info can be read on: 
>> http://insight-journal.org/dspace/handle/1926/191
>>
>> Maybe someone can help on my way? I would appreciate it!
>>
>> Mark
>>
>> ps. I'm currently working on solaris
>> _______________________________________________
>> Insight-users mailing list
>> Insight-users at itk.org
>> http://www.itk.org/mailman/listinfo/insight-users
>>
> ------------------------------------------------------------------------
>
> SET(ITKIO_SRCS
>   itkNiftiImageIO.cxx
>   itkNiftiImageIOFactory.cxx
>   itkAnalyzeImageIO.cxx
>   itkAnalyzeImageIOFactory.cxx
>   itkArchetypeSeriesFileNames.cxx
>   itkBioRadImageIO.cxx
>   itkBioRadImageIOFactory.cxx
>   itkBMPImageIO.cxx
>   itkBMPImageIOFactory.cxx
>   itkBrains2HeaderBase.cxx
>   itkBrains2HeaderFactory.cxx
>   itkBrains2IPLHeaderInfo.cxx
>   itkBrains2MaskHeaderInfo.cxx
>   itkBrains2MaskImageIO.cxx
>   itkBrains2MaskImageIOFactory.cxx
>   itkDICOMImageIO2.cxx
>   itkDICOMImageIO2Factory.cxx
>   itkDICOMSeriesFileNames.cxx
>   itkDicomImageIOFactory.cxx
>   itkGDCMImageIO.cxx
>   itkGDCMImageIOFactory.cxx
>   itkGDCMSeriesFileNames.cxx
>   itkGE4ImageIO.cxx
>   itkGE4ImageIOFactory.cxx
>   itkGE5ImageIO.cxx
>   itkGE5ImageIOFactory.cxx
>   itkGEAdwImageIO.cxx
>   itkGEAdwImageIOFactory.cxx
>   itkGiplImageIO.cxx
>   itkGiplImageIOFactory.cxx
>   itkIOCommon.cxx
>   itkIPLCommonImageIO.cxx
>   itkIPLFileNameList.cxx
>   itkImageIOBase.cxx
>   itkImageIOFactory.cxx
>   itkImageIORegion.cxx
>   itkJPEGImageIO.cxx
>   itkJPEGImageIOFactory.cxx
>   itkLSMImageIO.cxx
>   itkLSMImageIOFactory.cxx
>   itkMetaImageIO.cxx
>   itkMetaImageIOFactory.cxx
>   itkNrrdImageIO.cxx
>   itkNrrdImageIOFactory.cxx
>   itkNumericSeriesFileNames.cxx
>   itkPNGImageIO.cxx
>   itkPNGImageIOFactory.cxx
>   itkPolygonGroupSpatialObjectXMLFile.cxx
>   itkRegularExpressionSeriesFileNames.cxx
>   itkSiemensVisionImageIO.cxx
>   itkSiemensVisionImageIOFactory.cxx
>   itkStimulateImageIO.cxx
>   itkStimulateImageIOFactory.cxx
>   itkTIFFImageIO.cxx
>   itkTIFFImageIOFactory.cxx
>   itkTransformFileReader.cxx
>   itkTransformFileWriter.cxx
>   itkVTKImageIO.cxx
>   itkVTKImageIOFactory.cxx
>   itkXMLFile.cxx
> )
>
> IF(USE_MINC2)
>   INCLUDE_DIRECTORIES( ${MINC2_INCLUDE_PATH} ${HDF5_INCLUDE_PATH} ${NETCDF_INCLUDE_PATH})
>   SET(ITKIO_SRCS ${ITKIO_SRCS}  itkMINC2ImageIO.cxx itkMINC2ImageIOFactory.cxx)
> ENDIF(USE_MINC2)
>
>
> # Add ITKIO library
> ADD_LIBRARY(ITKIO ${ITKIO_SRCS})
>
> TARGET_LINK_LIBRARIES(ITKIO
> ITKCommon
> ITKNrrdIO
> itkjpeg8
> itkjpeg12
> itkjpeg16
> ${ITK_GDCM_LIBRARIES}
> ${ITK_PNG_LIBRARIES}
> ${ITK_ZLIB_LIBRARIES}
> ${ITK_TIFF_LIBRARIES}
> ITKSpatialObject
> ITKMetaIO
> ITKDICOMParser
> ITKEXPAT
> ITKniftiio)
>
> IF(USE_MINC2)
>    TARGET_LINK_LIBRARIES(ITKIO ${NETCDF_LIB} ${HDF5_LIB} ${MINC2_LIB})
> ENDIF(USE_MINC2)
>
> IF(ITK_LIBRARY_PROPERTIES)
>   SET_TARGET_PROPERTIES(ITKIO PROPERTIES ${ITK_LIBRARY_PROPERTIES})
> ENDIF(ITK_LIBRARY_PROPERTIES)
> INSTALL_TARGETS(/lib/InsightToolkit ITKIO)
> INSTALL_FILES(/include/InsightToolkit/IO "(\\.h|\\.txx)$")
>   
> ------------------------------------------------------------------------
>
> /*=========================================================================
>
>   Program:   Insight Segmentation & Registration Toolkit
>   Module:    $RCSfile: itkImageIOFactory.cxx,v $
>   Language:  C++
>   Date:      $Date: 2006/05/10 20:27:16 $
>   Version:   $Revision: 1.31 $
>
>   Copyright (c) Insight Software Consortium. All rights reserved.
>   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
>
>      This software is distributed WITHOUT ANY WARRANTY; without even 
>      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
>      PURPOSE.  See the above copyright notices for more information.
>
> =========================================================================*/
> #ifdef _MSC_VER
> #pragma warning ( disable : 4786 )
> #endif
>
> #include "itkImageIOFactory.h"
> #include "itkBioRadImageIOFactory.h"
> #include "itkBMPImageIOFactory.h"
> #include "itkGDCMImageIOFactory.h"
> #include "itkDICOMImageIO2Factory.h"
> #include "itkNiftiImageIOFactory.h"
> #include "itkAnalyzeImageIOFactory.h"
> #include "itkNiftiImageIOFactory.h"
> #include "itkGiplImageIOFactory.h"
> #include "itkJPEGImageIOFactory.h"
> #include "itkLSMImageIOFactory.h"
> #include "itkMetaImageIOFactory.h"
> #include "itkPNGImageIOFactory.h"
> #include "itkNrrdImageIOFactory.h"
> #include "itkTIFFImageIOFactory.h"
> #include "itkVTKImageIOFactory.h"
> #include "itkStimulateImageIOFactory.h"
> #include "itkMINC2ImageIOFactory.h"
> #include "itkMutexLock.h"
> #include "itkMutexLockHolder.h"
>
> namespace itk
> {
>
> ImageIOBase::Pointer
> ImageIOFactory::CreateImageIO(const char* path, FileModeType mode)
> {
>
>   RegisterBuiltInFactories();
>
>   std::list<ImageIOBase::Pointer> possibleImageIO;
>   std::list<LightObject::Pointer> allobjects =
>     ObjectFactoryBase::CreateAllInstance("itkImageIOBase");
>   for(std::list<LightObject::Pointer>::iterator i = allobjects.begin();
>       i != allobjects.end(); ++i)
>     {
>     ImageIOBase* io = dynamic_cast<ImageIOBase*>(i->GetPointer());
>     if(io)
>       {
>       possibleImageIO.push_back(io);
>       }
>     else
>       {
>       std::cerr << "Error ImageIO factory did not return an ImageIOBase: "
>                 << (*i)->GetNameOfClass()
>                 << std::endl;
>       }
>     }
>   for(std::list<ImageIOBase::Pointer>::iterator k = possibleImageIO.begin();
>       k != possibleImageIO.end(); ++k)
>     {
>     if( mode == ReadMode )
>       {
>       if((*k)->CanReadFile(path))
>         {
>         return *k;
>         }
>       }
>     else if( mode == WriteMode )
>       {
>       if((*k)->CanWriteFile(path))
>         {
>         return *k;
>         }
>
>       }
>     }
>   return 0;
> }
>
> void
> ImageIOFactory::RegisterBuiltInFactories()
> {
>   static bool firstTime = true;
>
>   static SimpleMutexLock mutex;
>   {
>   // This helper class makes sure the Mutex is unlocked
>   // in the event an exception is thrown.
>   MutexLockHolder<SimpleMutexLock> mutexHolder( mutex );
>   if( firstTime )
>     {
>     ObjectFactoryBase::RegisterFactory( BioRadImageIOFactory::New() );
>     ObjectFactoryBase::RegisterFactory( GDCMImageIOFactory::New() );
>     ObjectFactoryBase::RegisterFactory( MetaImageIOFactory::New() );
>     ObjectFactoryBase::RegisterFactory( PNGImageIOFactory::New() );
>     ObjectFactoryBase::RegisterFactory( VTKImageIOFactory::New() );
>     ObjectFactoryBase::RegisterFactory( GiplImageIOFactory::New() );
>     ObjectFactoryBase::RegisterFactory( LSMImageIOFactory::New()); //should be before TIFF
>     ObjectFactoryBase::RegisterFactory( NiftiImageIOFactory::New());
>     ObjectFactoryBase::RegisterFactory( AnalyzeImageIOFactory::New());
>     ObjectFactoryBase::RegisterFactory( StimulateImageIOFactory::New());
>     ObjectFactoryBase::RegisterFactory( JPEGImageIOFactory::New());
>     ObjectFactoryBase::RegisterFactory( TIFFImageIOFactory::New());
>     ObjectFactoryBase::RegisterFactory( NrrdImageIOFactory::New() );
>     ObjectFactoryBase::RegisterFactory( BMPImageIOFactory::New() );
>     ObjectFactoryBase::RegisterFactory( DICOMImageIO2Factory::New() );
>     ObjectFactoryBase::RegisterFactory( MINC2ImageIOFactory::New() );
>     firstTime = false;
>     }
>   }
>
> }
>
> } // end namespace itk
>   



More information about the Insight-users mailing list