Add uniqueID and SliceCount to ExtendMedicalImageProperties

This commit is contained in:
Krad
2022-03-04 13:48:20 +08:00
parent a4d1cd57be
commit 731d4ae4dd
3 changed files with 21 additions and 13 deletions

View File

@@ -102,6 +102,14 @@ void DICOMDirectoryHelper::getFileProperty(const std::string &path, DICOMFileMap
ReadTAGToProperty(StudyID, 0x0020, 0x0010); ReadTAGToProperty(StudyID, 0x0020, 0x0010);
seriesProperty->SetSeriesUID(SeriesUID.c_str()); seriesProperty->SetSeriesUID(SeriesUID.c_str());
seriesProperty->SetSeriesNumber(SeriesNumber); seriesProperty->SetSeriesNumber(SeriesNumber);
std::string uniqueID;
uniqueID.append(PatientName);
uniqueID.append("_");
uniqueID.append(StudyUID);
uniqueID.append("_");
uniqueID.append(SeriesUID);
seriesProperty->SetUniqueID(uniqueID);
double WindowCenter = 0.0; double WindowCenter = 0.0;
dataset->findAndGetFloat64(DcmTagKey(0x0028, 0x1050), WindowCenter); dataset->findAndGetFloat64(DcmTagKey(0x0028, 0x1050), WindowCenter);
double WindowWidth = 0.0; double WindowWidth = 0.0;

View File

@@ -144,13 +144,7 @@ SeriesImageSet* DicomLoader::getSeriesImageSet(const std::string& uniqueID)//, D
if (reader) reader->Delete(); if (reader) reader->Delete();
reader = vtkDICOMImageReader2::New(); reader = vtkDICOMImageReader2::New();
auto iter = std::find_if(imageProperties.begin(), imageProperties.end(),[&uniqueID](auto property){ auto iter = std::find_if(imageProperties.begin(), imageProperties.end(),[&uniqueID](auto property){
std::string id; return property->GetUniqueID()==uniqueID;
id.append(property->GetPatientName());
id.append("_");
id.append(property->GetStudyUID());
id.append("_");
id.append(property->GetSeriesUID());
return id == uniqueID;
}); });
if (iter==imageProperties.end()) return nullptr; if (iter==imageProperties.end()) return nullptr;
@@ -217,12 +211,7 @@ void DicomLoader::readTags(const std::string &dir, SeriesOpenMode openMode)
} }
if ( imageProperties.size() > 0 ) { if ( imageProperties.size() > 0 ) {
currentImageProperty = imageProperties[0]; currentImageProperty = imageProperties[0];
defaultUniqueID = ""; defaultUniqueID = currentImageProperty->GetUniqueID();
defaultUniqueID.append(currentImageProperty->GetPatientName());
defaultUniqueID.append("_");
defaultUniqueID.append(currentImageProperty->GetStudyUID());
defaultUniqueID.append("_");
defaultUniqueID.append(currentImageProperty->GetSeriesUID());
} }
readSeries(); readSeries();
} }

View File

@@ -59,6 +59,16 @@ public:
if (FileNames.empty()) return nullptr; if (FileNames.empty()) return nullptr;
return FileNames[FileNames.size()/2].data(); return FileNames[FileNames.size()/2].data();
} }
unsigned long long GetSliceCount(){
return FileNames.size();
}
const std::string& GetUniqueID(){
return uniqueID;
}
void SetUniqueID(const std::string& id){
uniqueID = id;
}
protected: protected:
ExtendMedicalImageProperties(); ExtendMedicalImageProperties();
@@ -69,6 +79,7 @@ protected:
long AcquisitionNumber = 0; long AcquisitionNumber = 0;
unsigned short SamplePerPixel; unsigned short SamplePerPixel;
std::vector<std::string> FileNames; std::vector<std::string> FileNames;
std::string uniqueID;
private: private:
ExtendMedicalImageProperties(const ExtendMedicalImageProperties&) = delete; ExtendMedicalImageProperties(const ExtendMedicalImageProperties&) = delete;
void operator=(const ExtendMedicalImageProperties&) = delete; void operator=(const ExtendMedicalImageProperties&) = delete;