Commit afe05ef1 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Refactoring code for the DICOM format support.

parent 5377fab0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ ADD_SUBDIRECTORY( arrays )
ADD_SUBDIRECTORY( containers )
ADD_SUBDIRECTORY( cuda )
ADD_SUBDIRECTORY( vectors )
ADD_SUBDIRECTORY( io )
ADD_SUBDIRECTORY( images )

set (headers tnlAssert.h               
             tnlConstants.h
+17 −12
Original line number Diff line number Diff line
set( headers DicomHeader.h
             ImageInfoObj.h
             SeriesInfoObj.h
             tnlJPEGImage.h
             tnlPGMImage.h
             tnlPNGImage.h
             tnlRegionOfInterest.h
             DicomSeries.h
             PatientInfoObj.h
set( headers tnlDicomHeader.h
             tnlDicomHeader_impl.h
             tnlDicomImageInfo.h
             tnlDicomImageInfo_impl.h
             tnlDicomSeriesInfo.h
             tnlDicomSeriesInfo_impl.h
             tnlDicomSeries.h
             tnlDicomSeries_impl.h
             tnlDicomPatientInfo.h
             tnlDicomPatientInfo_impl.h
             tnlImage.h
             tnlJPEGImage.h
             tnlJPEGImage_impl.h
             tnlPGMImage.h
             tnlPGMImage_impl.h
             tnlPNGImage.h
             tnlPNGImage_impl.h            
             tnlRegionOfInterest.h                                                    
             tnlRegionOfInterest_impl.h )

SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/core/io )
SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/core/images )

####
# DCMTK currently does not support shared libraries. When it does _impl.h files
@@ -36,4 +41,4 @@ ELSE()
ENDIF()    

        
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/core/io )
 No newline at end of file
INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/core/images )
 No newline at end of file
+15 −13
Original line number Diff line number Diff line
@@ -2,9 +2,11 @@
                          tnlDicomHeader.h  -  description
                             -------------------
    begin                : Jul 19, 2015
    copyright            : (C) 2015 by Jiri Kafka,
                                       Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
     
     Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
     Jiri Kafka          kafka9@seznam.cz
     Pavel Neskudla
 ***************************************************************************/

/***************************************************************************
@@ -27,9 +29,9 @@
#include <dcmtk/dcmdata/dcdeftag.h>
#endif

class SeriesInfoObj;
class PatientInfoObj;
class ImageInfoObj;
class tnlDicomSeriesInfo;
class tnlDicomPatientInfo;
class tnlDicomImageInfo;

/***
 * Class provides acces to the DICOM file header (contains complete
@@ -48,21 +50,21 @@ class tnlDicomHeader
      inline DcmFileFormat &getFileFormat();
#endif
      
      inline ImageInfoObj &getImageInfoObj();
      inline tnlDicomImageInfo &getImageInfo();
      
      inline PatientInfoObj &getPatientInfoObj();
      inline tnlDicomPatientInfo &getPatientInfo();
      
      inline SeriesInfoObj &getSeriesInfoObj();
      inline tnlDicomSeriesInfo &getSeriesInfo();

      inline bool loadFromFile( const char* fileName );

   protected:
      
      ImageInfoObj *imageInfoObj;
      tnlDicomImageInfo *imageInfoObj;
      
      PatientInfoObj *patientInfoObj;
      tnlDicomPatientInfo *patientInfoObj;
      
      SeriesInfoObj *seriesInfoObj;
      tnlDicomSeriesInfo *seriesInfoObj;

#ifdef HAVE_DCMTK_H      
      DcmFileFormat *fileFormat;
@@ -71,6 +73,6 @@ class tnlDicomHeader
      bool isLoaded;
};

#include <core/io/DicomHeader_impl.h>
#include <core/images/tnlDicomHeader_impl.h>

#endif // TNLDICOMHEADER_H
+74 −0
Original line number Diff line number Diff line
/***************************************************************************
                          tnlDicomHeader_impl.h  -  description
                             -------------------
    begin                : Jul 19, 2015
    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
     
     Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
     Jiri Kafka          kafka9@seznam.cz
     Pavel Neskudla
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include <core/images/tnlDicomHeader.h>
#include <core/images/tnlDicomSeriesInfo.h>
#include <core/images/tnlDicomPatientInfo.h>
#include <core/images/tnlDicomImageInfo.h>

inline tnlDicomHeader::tnlDicomHeader()
{
    fileFormat = new DcmFileFormat();
    isLoaded = false;
    imageInfoObj = new tnlDicomImageInfo(*this);
    patientInfoObj = new tnlDicomPatientInfo(*this);
    seriesInfoObj = new tnlDicomSeriesInfo(*this);
}

inline tnlDicomHeader::~tnlDicomHeader()
{
    delete imageInfoObj;
    delete patientInfoObj;
    delete seriesInfoObj;
    delete fileFormat;
}

inline bool tnlDicomHeader::loadFromFile(const char *fileName)
{
    OFCondition status = fileFormat->loadFile(fileName);
    if(status.good())
    {
        isLoaded = true;
        return true;
    }
    isLoaded = false;
    return false;
}

inline DcmFileFormat &tnlDicomHeader::getFileFormat()
{
    return *fileFormat;
}

inline tnlDicomImageInfo &tnlDicomHeader::getImageInfo()
{
    return *imageInfoObj;
}

inline tnlDicomPatientInfo &tnlDicomHeader::getPatientInfo()
{
    return *patientInfoObj;
}

inline tnlDicomSeriesInfo &tnlDicomHeader::getSeriesInfo()
{
    return *seriesInfoObj;
}
+103 −0
Original line number Diff line number Diff line
#ifndef IMAGEINFOOBJ_H
#define IMAGEINFOOBJ_H
/***************************************************************************
                          tnlDicomImageInfo.h  -  description
                             -------------------
    begin                : Jul 19, 2015
    copyright            : (C) 2015 by Tomas Oberhuber et al.                                       
     
     Tomas Oberhuber     tomas.oberhuber@fjfi.cvut.cz
     Jiri Kafka          kafka9@seznam.cz
     Pavel Neskudla
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TNLDICOMIMAGEINFO_H
#define TNLDICOMIMAGEINFO_H

#include <tnlConfig.h>

@@ -35,13 +55,13 @@ struct PixelSpacing
    double x, y;
    };

class ImageInfoObj
class tnlDicomImageInfo
{
   public:
      
      inline ImageInfoObj( tnlDicomHeader &tnlDicomHeader);
      inline tnlDicomImageInfo( tnlDicomHeader &tnlDicomHeader);
       
      inline virtual ~ImageInfoObj();
      inline virtual ~tnlDicomImageInfo();

      inline ImagePositionToPatient getImagePositionToPatient();
      
@@ -78,6 +98,6 @@ class ImageInfoObj
      int width, height, depth;
};

#include <core/io/ImageInfoObj_impl.h>
#include <core/images/tnlDicomImageInfo_impl.h>

#endif // IMAGEINFOOBJ_H
#endif // TNLDICOMIMAGEINFO_H
Loading