Skip to content

Commit

Permalink
ENH: fixing issues identified by tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fedorov committed Jun 22, 2017
1 parent ae7ff4c commit 3baebf7
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apps/paramaps/itkimage2paramap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int argc, char *argv[])
std::string metadata( (std::istreambuf_iterator<char>(metainfoStream) ),
(std::istreambuf_iterator<char>()));

DcmDataset* result = dcmqi::ParametricMapConverter::itkimage2paramap(parametricMapImage, dcmDatasets, metadata);
DcmDataset* result = dcmqi::itkimage2paramapReplacement(parametricMapImage, dcmDatasets, metadata);

if (result == NULL) {
return EXIT_FAILURE;
Expand Down
13 changes: 8 additions & 5 deletions include/dcmqi/DICOMFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,26 @@ namespace dcmqi {
if(dataset->findAndGetOFString(DCM_SOPClassUID, classUIDOF).good()){
classUID = classUIDOF.c_str();
}

};

int getFrameNumber() const {
return frameNumber; // 0 for legacy datasets, 1 or above for enhanced objects
};

int getFrameNumber() const; // 0 for legacy datasets, 1 or above for enhanced objects
OFString getInstanceUID() const;
vnl_vector<double> getFrameIPP(){
return frameIPP;
};

string getSeriesUID(){
string getSeriesUID() const {
return seriesUID;
}

string getInstanceUID(){
string getInstanceUID() const{
return instanceUID;
}

string getClassUID(){
string getClassUID() const {
return classUID;
}

Expand Down
6 changes: 5 additions & 1 deletion include/dcmqi/MultiframeObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class MultiframeObject {
int initializeVolumeGeometryFromITK(DummyImageType::Pointer);

// initialize attributes of the composite context that are common for all multiframe objects
virtual int initializeCompositeContext();
//virtual int initializeCompositeContext();
// check whether all of the attributes required for initialization of the object are present in the
// input metadata
virtual bool metaDataIsComplete();
Expand Down Expand Up @@ -113,8 +113,12 @@ class MultiframeObject {
Json::Value metaDataJson;

// Multiframe DICOM object representation
// probably not needed, since need object-specific DCMTK class in
// derived classes
DcmDataset* dcmRepresentation;

// probably not needed at this level, since for SEG each segment will
// have separate geometry definition
ImageVolumeGeometry volumeGeometry;

// DcmDataset(s) that hold the original representation of the
Expand Down
4 changes: 4 additions & 0 deletions include/dcmqi/ParametricMapObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class ParametricMapObject : public MultiframeObject {

int updateMetaDataFromDICOM(std::vector<DcmDataset*>);

DPMParametricMapIOD* getDICOMRepresentation(){
return parametricMap;
};

protected:
typedef itk::CastImageFilter<Float32ITKImageType,DummyImageType>
Float32ToDummyCasterType;
Expand Down
1 change: 1 addition & 0 deletions libsrc/DICOMFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace dcmqi {
int DICOMFrame::initializeFrameGeometryFromLegacyInstance() {
OFString ippStr;
frameIPP.set_size(3);
for(int j=0;j<3;j++){
CHECK_COND(frameDataset->findAndGetOFString(DCM_ImagePositionPatient, ippStr, j));
frameIPP[j] = atof(ippStr.c_str());
Expand Down
12 changes: 12 additions & 0 deletions libsrc/MultiframeObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@ int MultiframeObject::initializeMetaDataFromString(const std::string &metaDataSt

int MultiframeObject::initializeEquipmentInfo() {
if(sourceRepresentationType == ITK_REPR){
equipmentInfoModule = IODEnhGeneralEquipmentModule::EquipmentInfo(QIICR_MANUFACTURER, QIICR_DEVICE_SERIAL_NUMBER,
QIICR_MANUFACTURER_MODEL_NAME, QIICR_SOFTWARE_VERSIONS);
/*
equipmentInfoModule.m_Manufacturer = QIICR_MANUFACTURER;
equipmentInfoModule.m_DeviceSerialNumber = QIICR_DEVICE_SERIAL_NUMBER;
equipmentInfoModule.m_ManufacturerModelName = QIICR_MANUFACTURER_MODEL_NAME;
equipmentInfoModule.m_SoftwareVersions = QIICR_SOFTWARE_VERSIONS;
*/

} else { // DICOM_REPR
}
return EXIT_SUCCESS;
}

int MultiframeObject::initializeContentIdentification() {

if(sourceRepresentationType == ITK_REPR){
CHECK_COND(contentIdentificationMacro.setContentCreatorName("dcmqi"));
if(metaDataJson.isMember("ContentDescription")){
Expand All @@ -40,6 +46,12 @@ int MultiframeObject::initializeContentIdentification() {
} else {
CHECK_COND(contentIdentificationMacro.setContentLabel("DCMQI"));
}
if(metaDataJson.isMember("InstanceNumber")){
CHECK_COND(contentIdentificationMacro.setInstanceNumber(metaDataJson["InstanceNumber"].asCString()));
} else {
CHECK_COND(contentIdentificationMacro.setInstanceNumber("1"));
}
CHECK_COND(contentIdentificationMacro.check())
return EXIT_SUCCESS;
} else { // DICOM_REPR
}
Expand Down
12 changes: 8 additions & 4 deletions libsrc/ParametricMapConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
// DCMQI includes
#include "dcmqi/ParametricMapConverter.h"
#include "dcmqi/SegmentationImageConverter.h"
#include "dcmqi/ParametricMapObject.h"

using namespace std;

namespace dcmqi {

DcmDataset* itkimage2paramapReplacement(const FloatImageType::Pointer &parametricMapImage, vector<DcmDataset*> dcmDatasets,
const string &metaData) {
/*
ParametricMapConverter pmConverter(parametricMapImage, dcmDatasets, metaData);
pmConverter.convert();
ParametricMapObject pm;
pm.initializeFromITK(parametricMapImage, metaData, dcmDatasets);

DPMParametricMapIOD* pmap = pm.getDICOMRepresentation();

DcmDataset* output = new DcmDataset();
CHECK_COND(pmap->writeDataset(*output));

return convert.getDataset(); */
return NULL;
}

Expand Down
6 changes: 5 additions & 1 deletion libsrc/ParametricMapObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ int ParametricMapObject::initializeFromITK(Float32ITKImageType::Pointer inputIma
// NB: the sequence of steps initializing different components of the object parallels that
// in the original converter function. It probably makes sense to revisit the sequence
// of these steps. It does not necessarily need to happen in this order.
initializeEquipmentInfo();
initializeContentIdentification();

// TODO: consider creating parametric map object after all FGs are initialized instead
createParametricMap();
Expand Down Expand Up @@ -101,8 +103,10 @@ int ParametricMapObject::createParametricMap() {

DPMTypes::CQ_RESEARCH);
// TODO: look into the following, check with @che85 on the purpose of this line!
if (OFCondition* pCondition = OFget<OFCondition>(&obj))
if (OFCondition* pCondition = OFget<OFCondition>(&obj)) {
std::cerr << "Failed to create parametric map object!" << std::endl;
return EXIT_FAILURE;
}

parametricMap = OFget<DPMParametricMapIOD>(&obj);

Expand Down

0 comments on commit 3baebf7

Please sign in to comment.