From 8164936fc9ed1e00dd598711411917c3d31f7f6e Mon Sep 17 00:00:00 2001 From: jpr Date: Mon, 4 Apr 2011 17:01:03 +0000 Subject: [PATCH] fixes --- vtk/vtkGdcm4DSplitter.cxx | 49 +++++++++++++++++++++------------------ vtk/vtkGdcm4DSplitter.h | 15 ++++++------ 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/vtk/vtkGdcm4DSplitter.cxx b/vtk/vtkGdcm4DSplitter.cxx index 3f632c28..7e06563a 100644 --- a/vtk/vtkGdcm4DSplitter.cxx +++ b/vtk/vtkGdcm4DSplitter.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: vtkGdcm4DSplitter.cxx,v $ Language: C++ - Date: $Date: 2011/03/30 14:49:04 $ - Version: $Revision: 1.5 $ + Date: $Date: 2011/04/04 17:01:03 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -68,7 +68,6 @@ User will have to specify some points - ImageOrientationPatient void setSplitOnOrientation(); - User choosen tag - ==> WARNING : This one has troubles; do NOT use it, right now! void setSplitOnTag(unsigned short splitGroup, unsigned short splitElem); void setSplitConvertToFloat(bool conv); - UserDefined Function @@ -78,12 +77,21 @@ User will have to specify some points -------------------------- - ImagePositionPatient - void setSortOnPosition(); + void setSortOnPosition(); + - ImageOrientationPatient + ==> Only in your dreams! + ==> or, please, write a IOP sorter ... - User choosen tag + ==> WARNING : This one has troubles; do NOT use it, right now! + ==> use setSortOnUserFunction instead void setSortOnTag(unsigned short sortGroup, unsigned short sortElem); void setSortConvertToFloat(bool conv) - -. Execute + - UserDefined Function + void setSortOnUserFunction (FoncComp f); + - File name + void setSortOnFileName() + +. Execute : ----------- bool Go(); @@ -112,8 +120,8 @@ User will have to specify some points SortOnPosition(false), SortOnOrientation(false), SortOnTag(false), SortGroup(0), SortElem(0), SortConvertToFloat(false), - Recursive(false), TypeDir(0), - verbose(true) + Recursive(false), TypeDir(0), + verbose(false) { } @@ -145,8 +153,7 @@ User will have to specify some points } else return (vtkImageData*) NULL; - } - + } bool vtkGdcm4DSplitter::setDirName(std::string &dirName) { @@ -189,10 +196,10 @@ User will have to specify some points return true; } - /*static */bool vtkGdcm4DSplitter::CompareOnSortTagConvertToFloat(GDCM_NAME_SPACE::File *file1, GDCM_NAME_SPACE::File *file2) + bool vtkGdcm4DSplitter::CompareOnSortTagConvertToFloat(GDCM_NAME_SPACE::File *file1, GDCM_NAME_SPACE::File *file2) { /* if (verbose) printf ("%04x %04x\n", this->SortGroup,this->SortElem); - if (verbose) std :: cout << file1->GetEntryString(SortGroup,SortElem).c_str() << " : " + if (verbose) std :: cout << file1->GetEntryString(SortGroup,SortElem).c_str() << " : " << atof(file1->GetEntryString(SortGroup,SortElem).c_str()) << std::endl; */ @@ -200,11 +207,12 @@ User will have to specify some points return atof(file1->GetEntryString(SortGroup,SortElem).c_str()) < atof(file2->GetEntryString(SortGroup,SortElem).c_str()); } - /*static */bool vtkGdcm4DSplitter::CompareOnSortTag(GDCM_NAME_SPACE::File *file1, GDCM_NAME_SPACE::File *file2) + bool vtkGdcm4DSplitter::CompareOnSortTag(GDCM_NAME_SPACE::File *file1, GDCM_NAME_SPACE::File *file2) { return file1->GetEntryString(vtkGdcm4DSplitter::SortGroup,vtkGdcm4DSplitter::SortElem) < file2->GetEntryString(vtkGdcm4DSplitter::SortGroup,vtkGdcm4DSplitter::SortElem); } - + + bool vtkGdcm4DSplitter::Go() { if (!SplitOnPosition && !SplitOnOrientation && !SplitOnTag ) @@ -349,15 +357,7 @@ User will have to specify some points else if (SortOnOrientation) { if (verbose) std::cout << "SortOnOrientation" << std::endl; - /// \TODO SortOnOrientation() - // Within a 'just to see' program, - // OrderFileList() causes trouble, since some files - // (eg:MIP views) don't have 'Position', now considered as mandatory - // --> Activated on user demand. - - // Information is in : - // 0020,0032 : Image Position Patient - // 0020,0030 : Image Position (RET) + /// \TODO SortOnOrientation() // we still miss an algo to sort an Orientation, given by 6 cosines! // Anything like this, in GDCM2? @@ -384,6 +384,9 @@ User will have to specify some points std::cout << "Sorry, troubles not solved yet; use SortOnUserFunction, right now!" << std::endl; /* ==> WARNING : This one has troubles; do NOT use it, right now! + // a pointer to fonction cannot be casted as a pointer to member function! + // Use SortOnUserFunction, instead! + if ( SortConvertToFloat ) s->SetUserLessThanFunction( reinterpret_cast ( &vtkGdcm4DSplitter::CompareOnSortTagConvertToFloat)); diff --git a/vtk/vtkGdcm4DSplitter.h b/vtk/vtkGdcm4DSplitter.h index 908cbe79..6724a41f 100644 --- a/vtk/vtkGdcm4DSplitter.h +++ b/vtk/vtkGdcm4DSplitter.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: vtkGdcm4DSplitter.h,v $ Language: C++ - Date: $Date: 2011/03/31 21:45:12 $ - Version: $Revision: 1.5 $ + Date: $Date: 2011/04/04 17:01:03 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -22,9 +22,10 @@ #include #include #include "gdcmDirList.h" +#include "gdcmFile.h" typedef bool (*FoncComp) (GDCM_NAME_SPACE::File *file1, GDCM_NAME_SPACE::File *file2); -//typedef bool (vtkGdcm4DSplitter::*MembFoncComp)(GDCM_NAME_SPACE::File *file1, GDCM_NAME_SPACE::File *file2); + #define CALL_MEMBER_FONC(object, ptrToFoncMember) ((object).*(ptrToFoncMember)) //namespace GDCM_NAME_SPACE @@ -51,10 +52,10 @@ typedef bool (*FoncComp) (GDCM_NAME_SPACE::File *file1, G // ==== inline void setSortOnPosition() {SortOnPosition=true; SortOnOrientation=false; SortOnTag=false; SortOnFileName=false; SortOnUserFunction=false; SortOnPosition=true;} - - inline void setSortOnTag(unsigned short int sortGroup, unsigned short int sortElem) - {SortOnPosition=false; SortOnOrientation=false; SortOnTag=true; SortOnFileName=false; SortOnUserFunction=false; - SortGroup=sortGroup; SortElem=sortElem;} + // use setSortOnUserFunction, instead! + // inline void setSortOnTag(unsigned short int sortGroup, unsigned short int sortElem) + // {SortOnPosition=false; SortOnOrientation=false; SortOnTag=true; SortOnFileName=false; SortOnUserFunction=false; + // SortGroup=sortGroup; SortElem=sortElem;} inline void setSortOnUserFunction (FoncComp f) { UserCompareFunction=f; -- 2.45.0