mirror of
https://gitlab.ethz.ch/gfattori/glocalize.git
synced 2026-05-03 13:44:26 +02:00
149 lines
3.4 KiB
C++
149 lines
3.4 KiB
C++
#ifndef _DICOMSCANSERVICE_H_
|
|
#define _DICOMSCANSERVICE_H_
|
|
|
|
#include <qstring.h>
|
|
#include <functional>
|
|
#include <utility>
|
|
#include "gPatientRTGeneralInfos.h"
|
|
//#include "wrkDirParser.h"
|
|
#include <qdir.h>
|
|
#include <vtkSmartPointer.h>
|
|
#include <vtkImageData.h>
|
|
#include "dicomUtils.h"
|
|
|
|
|
|
/*_________________________________________________________-
|
|
|
|
Patient loader for gLocalize.
|
|
no wrkDir behaviour. just load data
|
|
____________________________________________________________*/
|
|
|
|
|
|
#include "connectITKVTK.h"
|
|
//#include "itkAnalyzeImageIO.h"
|
|
#include "itkChangeInformationImageFilter.h"
|
|
#include "itkImage.h"
|
|
#include "itkImage.h"
|
|
#include "itkImageFileWriter.h"
|
|
#include "itkOrientImageFilter.h"
|
|
#include "itkPermuteAxesImageFilter.h"
|
|
#include "itkRescaleIntensityImageFilter.h"
|
|
#include "itkImageSeriesReader.h"
|
|
#include "itkGDCMImageIO.h"
|
|
#include "itkGDCMSeriesFileNames.h"
|
|
#include "gdcmIPPSorter.h"
|
|
|
|
|
|
#ifndef TPATIENTORIENTATION
|
|
#define TPATIENTORIENTATION
|
|
typedef enum {
|
|
NOTDEFINED=0,
|
|
SUPINE = 1,
|
|
PRONE =2
|
|
} t_patientOrientation;
|
|
#endif
|
|
|
|
#ifndef PARSERVARIABLES
|
|
#define PARSERVARIABLES
|
|
enum patientErrors {
|
|
NOERRORS,
|
|
PARSER_FOLDER_NOTEXISTING,
|
|
PARSER_FOLDER_EMPTY,
|
|
PARSER_RTPLAN_NOTUNIQUE,
|
|
PARSER_RTPLAN_MISSING,
|
|
PARSER_RTSTRUCT_NOTUNIQUE,
|
|
PARSER_RTSTRUCT_MISSING,
|
|
PARSER_CT_FILES_MISSING,
|
|
PARSER_CT_FAILED_SORTING,
|
|
POPULATE_INCONSISTENT_DATASET,
|
|
POPULATE_NOTEXISTING,
|
|
CLEAR_FOLDER_NOTEXISTING
|
|
};
|
|
|
|
|
|
enum patientParseOption{
|
|
NOCLEAN,
|
|
CLEAN
|
|
};
|
|
enum patientCleanMode{
|
|
JUSTCLEAR,
|
|
ISLOADINGCHECK
|
|
};
|
|
#endif
|
|
|
|
#ifndef _T_REFERENCE_
|
|
#define _T_REFERENCE_
|
|
typedef enum{
|
|
DCMREF=0,
|
|
RTREF=1,
|
|
GOTSREF=2
|
|
}t_reference;
|
|
|
|
#endif
|
|
|
|
typedef itk::Image<short,3> myImageType;
|
|
|
|
|
|
class DicomScanService {
|
|
public:
|
|
DicomScanService();
|
|
~DicomScanService();
|
|
|
|
struct Callbacks {
|
|
std::function<void()> folderIsEmpty;
|
|
std::function<void(QString)> statusInfo;
|
|
std::function<void(int, gPatientRTGeneralInfos*)> parse_result;
|
|
std::function<void(QString)> loadFail;
|
|
std::function<void(vtkImageData*)> loadEnd;
|
|
std::function<void(double*)> loadedRTIso;
|
|
std::function<void(double*, double*, int*)> loadedVolBBox;
|
|
std::function<void(double, double, double)> referenceChange;
|
|
std::function<void(bool)> virtualIsoTested;
|
|
};
|
|
|
|
void setCallbacks(Callbacks cb) { callbacks = std::move(cb); }
|
|
|
|
|
|
public:
|
|
void load(QString p_loadDir);
|
|
void changeRef(int selectedRef);
|
|
|
|
private:
|
|
QString loadDir;
|
|
gPatientRTGeneralInfos* patientInfos;
|
|
void loadDICOM(std::vector<std::string> CTfilenames);
|
|
void connectToVTK();
|
|
void actualizeOut();
|
|
void parse(QString p_loadDir);
|
|
t_patientOrientation m_patientOrientation;
|
|
vtkSmartPointer <vtkImageData> vol3D;
|
|
|
|
myImageType::Pointer myImage;
|
|
itk::ImageSeriesReader<myImageType>::Pointer rDICOM;
|
|
itk::GDCMImageIO::Pointer iGDCMimage ;
|
|
itk::GDCMSeriesFileNames::Pointer myDICOMseries;
|
|
myImageType::DirectionType imageDir;
|
|
myImageType::PointType origin;
|
|
myImageType::SizeType sizeOfImage;
|
|
myImageType::PointType trueOffset;
|
|
myImageType::PointType trueOffset_rot;
|
|
myImageType::PointType trueOffset_rot_prev;
|
|
myImageType::DirectionType directionToWCS;
|
|
|
|
bool initialized;
|
|
|
|
vtkSmartPointer<vtkImageImport> out;
|
|
itk::VTKImageExport <myImageType>::Pointer in;
|
|
|
|
RTPlan * readRT;
|
|
double* m_rtIsocenter;
|
|
bool virtualIso;
|
|
t_reference m_reference;
|
|
|
|
|
|
private:
|
|
Callbacks callbacks;
|
|
};
|
|
|
|
#endif
|