forked from QIICR/dcmqi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: refactoring of the multiframe conversion implementation
This is an intermediate commit that aims to improve organization of the conversion functionality, motivated by the various standing issues (e.g., QIICR#217, QIICR#192 and QIICR#150) that are difficult to address with the current level of disarray in the code. Some of the ideas are the following: - introduce basic hierarchy of classes to allow reuse of the common functionality between PM and SEG converters (MultiFrameConverter parent for ParametricMapConverter and SegmentationImageConverter) - do not use static functions, instead make better use of converter classes - factor out containers to keep information about ImageVolume and DICOMFrame to simplify conversion and book keeping - improve consistency of naming and code style My plan to proceed with the refactoring is to implement "shadow" functions in the updated classes while keeping the original functions initially, and then phase out the original functions. The current commit is just an intermediate milestone to open this for feedback and keep development history at least somewhat incremental.
- Loading branch information
Showing
17 changed files
with
452 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// Created by Andrey Fedorov on 3/9/17. | ||
// | ||
|
||
#ifndef DCMQI_DICOMFRAME_H | ||
#define DCMQI_DICOMFRAME_H | ||
|
||
#include <dcmtk/dcmdata/dcdatset.h> | ||
|
||
namespace dcmqi { | ||
|
||
// Describe input/output frames for the purposes of sorting and associating with the | ||
// slices of the ITK volume | ||
class DICOMFrame { | ||
public: | ||
// distinguish between the frames from the legacy data and enhanced multiframe objects | ||
enum { | ||
LegacyInstanceFrame = 0, | ||
EnhancedInstanceFrame | ||
}; | ||
|
||
DICOMFrame(DcmDataset *dataset, int number) : | ||
frameNumber(number), | ||
frameDataset(dataset) { | ||
|
||
}; | ||
|
||
private: | ||
int frameType; | ||
DcmDataset *frameDataset; | ||
int frameNumber; | ||
OFString originStr; // revisit this | ||
}; | ||
} | ||
|
||
#endif //DCMQI_DICOMFRAME_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// Created by Andrey Fedorov on 3/9/17. | ||
// | ||
|
||
#ifndef DCMQI_IMAGEVOLUME_H | ||
#define DCMQI_IMAGEVOLUME_H | ||
|
||
#include <vnl/vnl_vector.h> | ||
#include <dcmtk/dcmfg/fginterface.h> | ||
#include <dcmtk/dcmiod/modfloatingpointimagepixel.h> | ||
|
||
#include <itkImage.h> | ||
|
||
namespace dcmqi { | ||
|
||
// Maintain properties of the image volume | ||
// Attributes ara parallel to those of itkImageData, but limited to what we need for the task of conversion, | ||
// and the class is not templated over the pixel type | ||
class ImageVolume { | ||
public: | ||
// pixel types that are relevant for the types of objects we want to support | ||
enum { | ||
FLOAT32 = 0, // PM | ||
FLOAT64, // PM | ||
UINT16 // PM or SEG | ||
}; | ||
|
||
typedef IODFloatingPointImagePixelModule::value_type Float32PixelType; | ||
typedef itk::Image<Float32PixelType, 3> Float32ITKImageType; | ||
|
||
ImageVolume(){ | ||
rowDirection.set_size(3); | ||
columnDirection.set_size(3); | ||
sliceDirection.set_size(3); | ||
origin.set_size(3); | ||
spacing.set_size(3); | ||
pixelData = NULL; | ||
} | ||
|
||
// while going from DICOM PM/SEG, we get volume information from FGInterface | ||
int initializeFromDICOM(FGInterface&); | ||
int initializeFromITK(Float32ITKImageType::Pointer); | ||
|
||
// TODO - inherited class? or separate segments before passing to this one? | ||
// int initializeFromSegment(FGInterface&, unsigned); | ||
|
||
protected: | ||
int initializeDirections(FGInterface &); | ||
int initializeExtent(FGInterface &); | ||
bool getDeclaredSpacing(FGInterface&); | ||
|
||
private: | ||
|
||
// use vnl_vector to simplify support of vector calculations | ||
vnl_vector<double> rowDirection, columnDirection, sliceDirection; | ||
vnl_vector<double> origin; | ||
unsigned sliceExtent; | ||
vnl_vector<double> spacing; | ||
void* pixelData; | ||
int pixelDataType; | ||
}; | ||
|
||
}; | ||
|
||
|
||
#endif //DCMQI_IMAGEVOLUME_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// Created by Andrey Fedorov on 3/9/17. | ||
// | ||
|
||
#ifndef DCMQI_SEGMENTVOLUME_H | ||
#define DCMQI_SEGMENTVOLUME_H | ||
|
||
#include "dcmqi/ImageVolume.h" | ||
|
||
namespace dcmqi { | ||
class SegmentVolume : public ImageVolume { | ||
|
||
}; | ||
} | ||
|
||
|
||
#endif //DCMQI_SEGMENTVOLUME_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// | ||
// Created by Andrey Fedorov on 3/9/17. | ||
// | ||
|
||
#include "dcmqi/DICOMFrame.h" |
Oops, something went wrong.