]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of /home/romulo/creatis/clitk3-git-shared/clitk3
authorVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Tue, 19 Apr 2011 13:46:25 +0000 (15:46 +0200)
committerVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Tue, 19 Apr 2011 13:46:25 +0000 (15:46 +0200)
1  2 
common/vvFromITK.h
vv/vvQDicomSeriesSelector.cxx
vv/vvQDicomSeriesSelector.h

diff --combined common/vvFromITK.h
index bd075731304eeb0ed735093edef484d45e3541d5,5a00f65d1220ae87964dd27a45fa74927a14761b..f1d548cd0d7f0b935aaf486bae78f15720601d33
@@@ -3,7 -3,7 +3,7 @@@
  
    Authors belong to: 
    - University of LYON              http://www.universite-lyon.fr/
-   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+   - Léon Bérard cancer center       http://www.centreleonberard.fr
    - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
  
    This software is distributed WITHOUT ANY WARRANTY; without even
@@@ -14,7 -14,7 +14,7 @@@
  
    - BSD        See included LICENSE.txt file
    - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
- ======================================================================-====*/
+ ===========================================================================**/
  #ifndef VVIMAGEFROMITK_H
  #define VVIMAGEFROMITK_H
  
@@@ -54,7 -54,6 +54,7 @@@ template<unsigned int Dim, class PixelT
              extractedRegion.SetIndex(start);
  
              typename FilterType::Pointer filter = FilterType::New();
 +            filter->SetDirectionCollapseToSubmatrix();
              filter->SetExtractionRegion(extractedRegion);
              filter->SetInput(input);
              filter->ReleaseDataFlagOn();
index f86efc28d769535c96872914426bb6c8e05a1456,30f1131ff646debc4e0151a3b58b9994bc8191e9..51f11a886cf7227b63af99d1a6b119aaec6287f2
@@@ -3,7 -3,7 +3,7 @@@
  
    Authors belong to:
    - University of LYON              http://www.universite-lyon.fr/
-   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+   - Léon Bérard cancer center       http://www.centreleonberard.fr
    - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
  
    This software is distributed WITHOUT ANY WARRANTY; without even
@@@ -14,7 -14,7 +14,7 @@@
  
    - BSD        See included LICENSE.txt file
    - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
- ======================================================================-====*/
+ ===========================================================================**/
  #ifndef VVDICOMSERIESSELECTOR_CXX
  #define VVDICOMSERIESSELECTOR_CXX
  #include <itkGDCMImageIO.h>
@@@ -137,8 -137,10 +137,8 @@@ void vvDicomSeriesSelector::SearchButto
  
        // store first header
  #if GDCM_MAJOR_VERSION == 2
 -      gdcm::ImageReader reader;
 -      reader.SetFileName( (*filenames)[0].c_str() );
 -      reader.Read();
 -      mDicomHeader[seriesUID[i]] = &reader.GetFile();
 +      mDicomHeader[seriesUID[i]].SetFileName( (*filenames)[0].c_str() );
 +      mDicomHeader[seriesUID[i]].Read();
  #else
        gdcm::File *header = new gdcm::File();
        header->SetFileName((*filenames)[0]);
@@@ -202,7 -204,7 +202,7 @@@ void vvDicomSeriesSelector::itemSelecti
    if (mDicomInfo[mCurrentSerie] == "") {
      //        QString m;
      //        m = QString("Patient : <font color=\"blue\">%1</font><br>").arg(mDicomHeader[s]->GetEntryValue(0x0010,0x0010).c_str()); // Patient's name
 -    DD(mCurrentSerie)
 +
      mDicomInfo[mCurrentSerie] = MakeDicomInfo(mCurrentSerie, mDicomHeader[mCurrentSerie]);
    }
    ui.mDicomInfoPanel->setText(mDicomInfo[mCurrentSerie]);
@@@ -225,20 -227,20 +225,20 @@@ void vvDicomSeriesSelector::itemDetails
    if (i<mFilenames->size()) {
      if (mDicomDetails[(*mFilenames)[i]] == "") {
        std::ostringstream s;
 -      mDicomHeader[mCurrentSerie]->Print(s);
 +      mDicomHeader[mCurrentSerie].GetFile().Print(s);
  
        QString l;
 -      gdcm::File * header = mDicomHeader[mCurrentSerie];
  #if GDCM_MAJOR_VERSION == 2
 +      const gdcm::File& header = mDicomHeader[mCurrentSerie].GetFile();
        gdcm::StringFilter sf;
 -      sf.SetFile( *header );
 -      gdcm::DataSet &ds = header->GetDataSet();
 +      sf.SetFile( header );
 +      const gdcm::DataSet &ds = header.GetDataSet();
        gdcm::DataSet::ConstIterator it = ds.Begin();
        for (; it != ds.End(); ++it )
          {
          const gdcm::DataElement & ref = *it;
          const gdcm::Tag &         tag = ref.GetTag();
 -        gdcm::VR vr = gdcm::DataSetHelper::ComputeVR(*header, ds, tag);
 +        gdcm::VR vr = gdcm::DataSetHelper::ComputeVR(header, ds, tag);
          if ( vr & ( gdcm::VR::OB | gdcm::VR::OF | gdcm::VR::OW | gdcm::VR::SQ | gdcm::VR::UN ) )
            {
            // What is the behavior for binary stuff ?
            }
          }
  #else
 +      gdcm::File * header = mDicomHeader[mCurrentSerie];
        gdcm::DocEntry * e = header->GetFirstEntry();
        while (e) {
          if (e->GetName() != "gdcm::Unknown") {
  //====================================================================
  
  //====================================================================
 -QString vvDicomSeriesSelector::MakeDicomInfo(std::string & s, gdcm::File *header)
 +#if GDCM_MAJOR_VERSION == 2
 +QString vvDicomSeriesSelector::MakeDicomInfo(std::string & s, const gdcm::Reader& header)
  {
    QString n = QString("%1").arg(mListOfSeriesFilenames[s]->size());
 -#if GDCM_MAJOR_VERSION == 2
 -  const gdcm::File &f = *header;
 +  const gdcm::File &f = header.GetFile();
    std::vector<double> thespacing = gdcm::ImageHelper::GetSpacingValue(f);
    std::vector<double> theorigin = gdcm::ImageHelper::GetOriginValue(f);
  
  
    QString ss =
      //AddInfo(        "Serie ID   : ", s)+
 -    AddInfo(header, "Patient : ", 0x0010,0x0010)+
 +    AddInfo(&header.GetFile(), "Patient : ", 0x0010,0x0010)+
      AddInfo(        "Folder : ", QFileInfo((*mFilenames)[0].c_str()).canonicalPath().toStdString())+
 -    AddInfo(header, "Series Description : ", 0x0008,0x103e)+
 -    AddInfo(header, "Modality : ", 0x0008,0x0060)+
 -    AddInfo(header, "# images : ", 0x0020,0x0013)+
 +    AddInfo(&header.GetFile(), "Series Description : ", 0x0008,0x103e)+
 +    AddInfo(&header.GetFile(), "Modality : ", 0x0008,0x0060)+
 +    AddInfo(&header.GetFile(), "# images : ", 0x0020,0x0013)+
      AddInfo(        "# files : ", n.toStdString())+
      AddInfo(        "Size : ", size.toStdString())+
      AddInfo(        "Spacing : ", spacing.toStdString())+
      AddInfo(        "Origin : ", origin.toStdString())+
 -    AddInfo(header, "Pixel size : ", 0x0028,0x0100)+
 -    AddInfo(        "Pixel type : ", 0);
 +    AddInfo(&header.GetFile(), "Pixel size : ", 0x0028,0x0100)+
 +    AddInfo(        "Pixel type : ", "");
 +  return ss;
 +}
  #else
 +QString vvDicomSeriesSelector::MakeDicomInfo(std::string & s, gdcm::File *header)
 +{
 +  QString n = QString("%1").arg(mListOfSeriesFilenames[s]->size());
    QString size = QString("%1x%2x%3")
                   .arg(header->GetXSize())
                   .arg(header->GetYSize())
      AddInfo(        "Origin : ", origin.toStdString())+
      AddInfo(header, "Pixel size : ", 0x0028,0x0100)+
      AddInfo(        "Pixel type : ", header->GetPixelType());
 -#endif
    return ss;
  }
 +#endif
  //====================================================================
  
  //====================================================================
 -QString vvDicomSeriesSelector::AddInfo(gdcm::File *header, QString n, uint16_t group, uint16_t elem)
 +QString vvDicomSeriesSelector::AddInfo(const gdcm::File *header, QString n, uint16_t group, uint16_t elem)
  {
  #if GDCM_MAJOR_VERSION == 2
    gdcm::StringFilter sf;
index a0b6ce038b2acce38cfc24798f8d1d416a56bbb0,e75e52603bb22b61d064c515d54cfff306caf540..8b3aaac0deab00f0f8f3f5e3e8da3fcc28380a57
@@@ -3,7 -3,7 +3,7 @@@
  
    Authors belong to: 
    - University of LYON              http://www.universite-lyon.fr/
-   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+   - Léon Bérard cancer center       http://www.centreleonberard.fr
    - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
  
    This software is distributed WITHOUT ANY WARRANTY; without even
@@@ -14,7 -14,7 +14,7 @@@
  
    - BSD        See included LICENSE.txt file
    - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
- ======================================================================-====*/
+ ===========================================================================**/
  #ifndef VVDICOMSERIESSELECTOR_H
  #define VVDICOMSERIESSELECTOR_H
  #include "ui_vvDicomSeriesSelector.h"
@@@ -48,12 -48,8 +48,12 @@@ protected
      QString mPreviousPath;
      QString mFoldername;
      void AddSerieToTheTable(int i, std::vector<std::string> & filenames);
 +#if GDCM_MAJOR_VERSION == 2
 +    QString MakeDicomInfo(std::string & s, const gdcm::Reader& header);
 +#else
      QString MakeDicomInfo(std::string & s, gdcm::File *header);
 -    QString AddInfo(gdcm::File *header, QString n, unsigned short group, unsigned short elem);
 +#endif
 +    QString AddInfo(const gdcm::File *header, QString n, unsigned short group, unsigned short elem);
      QString AddInfo(std::string n, std::string m);
  
  private:
      std::map<std::string, std::vector<std::string>* > mListOfSeriesFilenames;
      std::vector<std::string> * mFilenames;
      std::map<std::string, QString> mDicomInfo;
 +#if GDCM_MAJOR_VERSION == 2
 +    std::map<std::string, gdcm::Reader> mDicomHeader;
 +#else
      std::map<std::string, gdcm::File*> mDicomHeader;
 +#endif
      std::map<std::string, std::string> mDicomDetails;
  };