]> Creatis software - clitk.git/blob - common/clitkIO.cxx
Ensure compatibility with VTK7
[clitk.git] / common / clitkIO.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18
19 // std include
20 #include <iostream>
21 #include <fstream>
22
23 // itk include
24 #include "itkMacro.h"
25
26 // clitk include
27 #include "clitkIO.h"
28 #include "clitkImageCommon.h"
29 #include "clitkDicomRTDoseIOFactory.h"
30 #include "clitkVoxImageIOFactory.h"
31 #include "clitkVfImageIOFactory.h"
32 #include "clitkXdrImageIOFactory.h"
33 #include "rtkHisImageIOFactory.h"
34 #include "rtkHndImageIOFactory.h"
35 #include "rtkEdfImageIOFactory.h"
36 #include "rtkImagXImageIOFactory.h"
37 #include "rtkXRadImageIOFactory.h"
38 #include "clitkEsrfHstImageIOFactory.h"
39 #include "clitkGateAsciiImageIOFactory.h"
40 #include "clitkConfiguration.h"
41 #if CLITK_PRIVATE_FEATURES
42   #include "clitkUsfImageIOFactory.h"
43   #include "clitkUSVoxImageIOFactory.h"
44   #include "clitkSvlImageIOFactory.h"
45 #endif
46 #if ITK_VERSION_MAJOR >= 4
47   #include "itkGDCMImageIOFactory.h"
48   #include "itkPNGImageIOFactory.h"
49 #endif
50
51 //--------------------------------------------------------------------
52 // Register factories
53 void clitk::RegisterClitkFactories()
54 {
55 #if ITK_VERSION_MAJOR >= 4
56   std::list< itk::ObjectFactoryBase * > fl = itk::GDCMImageIOFactory::GetRegisteredFactories();
57   for (std::list< itk::ObjectFactoryBase * >::iterator it = fl.begin(); it != fl.end(); ++it)
58     if (dynamic_cast<itk::GDCMImageIOFactory *>(*it))
59     {
60       itk::GDCMImageIOFactory::UnRegisterFactory(*it);
61       break;
62     }
63
64   std::list< itk::ObjectFactoryBase * > flpng = itk::PNGImageIOFactory::GetRegisteredFactories();
65   for (std::list< itk::ObjectFactoryBase * >::iterator it = flpng.begin(); it != flpng.end(); ++it)
66     if (dynamic_cast<itk::PNGImageIOFactory *>(*it))
67     {
68       itk::PNGImageIOFactory::UnRegisterFactory(*it);
69       break;
70     }
71 #endif
72 #if CLITK_PRIVATE_FEATURES
73   clitk::UsfImageIOFactory::RegisterOneFactory();
74   clitk::USVoxImageIOFactory::RegisterOneFactory();
75   clitk::SvlImageIOFactory::RegisterOneFactory();
76 #endif
77   clitk::GateAsciiImageIOFactory::RegisterOneFactory();
78   clitk::DicomRTDoseIOFactory::RegisterOneFactory();
79 #if ITK_VERSION_MAJOR <= 3
80   itk::ImageIOFactory::RegisterBuiltInFactories();
81 #endif
82   clitk::VoxImageIOFactory::RegisterOneFactory();
83   clitk::VfImageIOFactory::RegisterOneFactory();
84   clitk::XdrImageIOFactory::RegisterOneFactory();
85   rtk::HisImageIOFactory::RegisterOneFactory();
86   rtk::HndImageIOFactory::RegisterOneFactory();
87   rtk::EdfImageIOFactory::RegisterOneFactory();
88   rtk::ImagXImageIOFactory::RegisterOneFactory();
89   rtk::XRadImageIOFactory::RegisterOneFactory();
90   clitk::EsrfHstImageIOFactory::RegisterOneFactory();
91 #if ITK_VERSION_MAJOR >= 4
92   itk::GDCMImageIOFactory::RegisterOneFactory();
93   itk::PNGImageIOFactory::RegisterOneFactory();
94 #endif
95 } ////
96