1 /*=========================================================================
4 Module: $RCSfile: vtkGdcm4DSplitter.h,v $
6 Date: $Date: 2011/09/20 16:05:15 $
7 Version: $Revision: 1.13 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #ifndef _VTKGDCM4DSPLITTER_H_
20 #define _VTKGDCM4DSPLITTER_H_
23 #include <vtkImageData.h>
24 #include "gdcmDirList.h"
26 #include "gdcmSerieHelper.h"
28 typedef bool (*FoncComp)(GDCM_NAME_SPACE::File *file1, GDCM_NAME_SPACE::File *file2);
30 #define CALL_MEMBER_FONC(object, ptrToFoncMember) ((object).*(ptrToFoncMember))
36 GDCM_NAME_SPACE::File *file;
40 //namespace GDCM_NAME_SPACE
42 class VTK_EXPORT vtkGdcm4DSplitter {
44 //-----------------------------------------------------------------------------
49 // Locate Data to process
50 // ======================
51 void setRecursive(bool recursive);
52 bool setDirName (std::string &dirName);
53 bool setVectDirName (std::vector<std::string> &vectDirName);
54 bool setVectFileName(std::vector<std::string> &vectFileName);
56 bool setVectGdcmFile(std::vector<GDCM_NAME_SPACE::File *> *vectGdcmFile);
58 void setFlipY(bool f) { FlipY = f; }
62 void setSplitOnPosition();
63 void setSplitOnOrientation();
64 void setSplitOnTag(unsigned short int splitGroup, unsigned short int splitElem);
66 void setSplitConvertToFloat(bool conv);
68 void setSplitOnly(bool s);
72 void setSortOnPosition();
73 // use setSortOnUserFunction, instead!
74 // void setSortOnTag(unsigned short int sortGroup, unsigned short int sortElem)
75 // {SortOnPosition=false; SortOnOrientation=false; SortOnTag=true; SortOnFileName=false; SortOnUserFunction=false;
76 // SortGroup=sortGroup; SortElem=sortElem;}
78 void setSortOnUserFunction (FoncComp f);
80 //void setSortConvertToFloat(bool conv);
82 void setSortOnFileName();
84 // SortOnOrientation : not yet made; IOP sorter missing!
85 //inline void setSortOnOrientation(){SortOnPosition=false; SortOnOrientation=true; SortOnTag=false; SortOnFileName=false; SortOnUserFunction=false;}
87 std::vector<vtkImageData*> *GetImageDataVector();
88 vtkImageData *GetImageData();
90 std::vector< GDCM_NAME_SPACE::FileList *> *GetVectGdcmFileLists();
96 bool CompareOnSortTag (GDCM_NAME_SPACE::File *file1, GDCM_NAME_SPACE::File *file2);
97 bool CompareOnSortTagConvertToFloat(GDCM_NAME_SPACE::File *file1, GDCM_NAME_SPACE::File *file2);
98 void reorgXCoherentFileSetmap (GDCM_NAME_SPACE::XCoherentFileSetmap &xcm);
99 bool sortVectElem(std::vector<ELEM> *le);
100 GDCM_NAME_SPACE::FileList * getGdcmFileList();
112 std::vector<std::string> VectDirName;
113 std::vector<std::string> VectFileName;
115 bool SplitOnPosition;
116 bool SplitOnOrientation;
119 unsigned short int SplitGroup;
120 unsigned short int SplitElem;
121 bool SplitConvertToFloat;
125 bool SortOnOrientation;
128 bool SortOnUserFunction;
130 FoncComp UserCompareFunction;
132 //unsigned short int SortGroup;
133 //unsigned short int SortElem;
134 //bool SortConvertToFloat;
144 GDCM_NAME_SPACE::XCoherentFileSetmap xcm;
147 // may be got by user
149 std::vector<vtkImageData*> *ImageDataVector;
150 GDCM_NAME_SPACE::FileList *VectGdcmFile; // std::vector of gdcm::File*
152 std::vector<GDCM_NAME_SPACE::FileList *> VectGdcmFileLists; // result of the splitting operation
155 //} // end namespace gdcm
157 //-----------------------------------------------------------------------------