Mercurial > hg > orthanc
changeset 77:b8dfde8d64e8
new dicom tags
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Sep 2012 13:41:18 +0200 |
parents | e2d68529605f |
children | 10bf2cd24d1d |
files | Core/DicomFormat/DicomMap.cpp Core/DicomFormat/DicomTag.cpp Core/DicomFormat/DicomTag.h OrthancServer/DicomIntegerPixelAccessor.cpp OrthancServer/DicomProtocol/DicomUserConnection.cpp OrthancServer/OrthancRestApi.cpp OrthancServer/PrepareDatabase.sql OrthancServer/ServerIndex.cpp Resources/CMake/DownloadPackage.cmake |
diffstat | 9 files changed, 105 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/DicomFormat/DicomMap.cpp Mon Sep 17 17:32:33 2012 +0200 +++ b/Core/DicomFormat/DicomMap.cpp Thu Sep 20 13:41:18 2012 +0200 @@ -30,54 +30,55 @@ { static DicomTag patientTags[] = { - DicomTag(0x0010, 0x0010), // PatientName - DicomTag(0x0010, 0x0020), // PatientID - DicomTag(0x0010, 0x0030), // PatientBirthDate - DicomTag(0x0010, 0x0040), // PatientSex - DicomTag(0x0010, 0x1000) // OtherPatientIDs //DicomTag(0x0010, 0x1010), // PatientAge //DicomTag(0x0010, 0x1040) // PatientAddress + DicomTag(0x0010, 0x0010), // PatientName + DicomTag(0x0010, 0x0030), // PatientBirthDate + DicomTag(0x0010, 0x0040), // PatientSex + DicomTag(0x0010, 0x1000), // OtherPatientIDs + DicomTag::PATIENT_ID }; static DicomTag studyTags[] = { - DicomTag(0x0008, 0x0020), // StudyDate - DicomTag(0x0008, 0x0030), // StudyTime - DicomTag(0x0008, 0x0050), // AccessionNumber - DicomTag(0x0008, 0x1030), // StudyDescription - DicomTag(0x0020, 0x000d), // StudyInstanceUID - DicomTag(0x0020, 0x0010) // StudyID //DicomTag(0x0010, 0x1020), // PatientSize //DicomTag(0x0010, 0x1030) // PatientWeight + DicomTag(0x0008, 0x0020), // StudyDate + DicomTag(0x0008, 0x0030), // StudyTime + DicomTag(0x0008, 0x1030), // StudyDescription + DicomTag(0x0020, 0x0010), // StudyID + DicomTag::ACCESSION_NUMBER, + DicomTag::STUDY_INSTANCE_UID }; static DicomTag seriesTags[] = { - DicomTag(0x0008, 0x0021), // SeriesDate - DicomTag(0x0008, 0x0031), // SeriesTime - DicomTag(0x0008, 0x0060), // Modality - DicomTag(0x0008, 0x0070), // Manufacturer - DicomTag(0x0008, 0x1010), // StationName - DicomTag(0x0008, 0x103e), // SeriesDescription //DicomTag(0x0010, 0x1080), // MilitaryRank - DicomTag(0x0018, 0x0015), // BodyPartExamined - DicomTag(0x0018, 0x0024), // SequenceName - DicomTag(0x0018, 0x1030), // ProtocolName - DicomTag(0x0020, 0x000e), // SeriesInstanceUID - DicomTag(0x0020, 0x0011), // SeriesNumber - DicomTag(0x0020, 0x1002), // ImagesInAcquisition - DicomTag(0x0054, 0x0081) // NumberOfSlices + DicomTag(0x0008, 0x0021), // SeriesDate + DicomTag(0x0008, 0x0031), // SeriesTime + DicomTag(0x0008, 0x0060), // Modality + DicomTag(0x0008, 0x0070), // Manufacturer + DicomTag(0x0008, 0x1010), // StationName + DicomTag(0x0008, 0x103e), // SeriesDescription + DicomTag(0x0018, 0x0015), // BodyPartExamined + DicomTag(0x0018, 0x0024), // SequenceName + DicomTag(0x0018, 0x1030), // ProtocolName + DicomTag(0x0020, 0x0011), // SeriesNumber + DicomTag::IMAGES_IN_ACQUISITION, + DicomTag::NUMBER_OF_SLICES, + DicomTag::SERIES_INSTANCE_UID }; static DicomTag instanceTags[] = { - DicomTag(0x0008, 0x0012), // InstanceCreationDate - DicomTag(0x0008, 0x0013), // InstanceCreationTime - DicomTag(0x0008, 0x0018), // SOPInstanceUID - DicomTag(0x0020, 0x0012), // AcquisitionNumber - DicomTag(0x0020, 0x0013), // InstanceNumber - DicomTag(0x0028, 0x0008), // NumberOfFrames - DicomTag(0x0054, 0x1330) // ImageIndex + DicomTag(0x0008, 0x0012), // InstanceCreationDate + DicomTag(0x0008, 0x0013), // InstanceCreationTime + DicomTag(0x0020, 0x0012), // AcquisitionNumber + DicomTag::CARDIAC_NUMBER_OF_IMAGES, + DicomTag::IMAGE_INDEX, + DicomTag::INSTANCE_NUMBER, + DicomTag::NUMBER_OF_FRAMES, + DicomTag::SOP_INSTANCE_UID }; @@ -227,7 +228,7 @@ SetupFindTemplate(result, seriesTags, sizeof(seriesTags) / sizeof(DicomTag)); result.SetValue(DicomTag::ACCESSION_NUMBER, ""); result.SetValue(DicomTag::PATIENT_ID, ""); - result.SetValue(DicomTag::STUDY_UID, ""); + result.SetValue(DicomTag::STUDY_INSTANCE_UID, ""); } void DicomMap::SetupFindInstanceTemplate(DicomMap& result) @@ -235,8 +236,8 @@ SetupFindTemplate(result, instanceTags, sizeof(instanceTags) / sizeof(DicomTag)); result.SetValue(DicomTag::ACCESSION_NUMBER, ""); result.SetValue(DicomTag::PATIENT_ID, ""); - result.SetValue(DicomTag::STUDY_UID, ""); - result.SetValue(DicomTag::SERIES_UID, ""); + result.SetValue(DicomTag::STUDY_INSTANCE_UID, ""); + result.SetValue(DicomTag::SERIES_INSTANCE_UID, ""); }
--- a/Core/DicomFormat/DicomTag.cpp Mon Sep 17 17:32:33 2012 +0200 +++ b/Core/DicomFormat/DicomTag.cpp Thu Sep 20 13:41:18 2012 +0200 @@ -61,11 +61,18 @@ const DicomTag DicomTag::ACCESSION_NUMBER = DicomTag(0x0008, 0x0050); - const DicomTag DicomTag::IMAGE_INDEX = DicomTag(0x0054, 0x1330); - const DicomTag DicomTag::INSTANCE_UID = DicomTag(0x0008, 0x0018); - const DicomTag DicomTag::NUMBER_OF_SLICES = DicomTag(0x0054, 0x0081); + const DicomTag DicomTag::SOP_INSTANCE_UID = DicomTag(0x0008, 0x0018); const DicomTag DicomTag::PATIENT_ID = DicomTag(0x0010, 0x0020); - const DicomTag DicomTag::SERIES_UID = DicomTag(0x0020, 0x000e); - const DicomTag DicomTag::STUDY_UID = DicomTag(0x0020, 0x000d); + const DicomTag DicomTag::SERIES_INSTANCE_UID = DicomTag(0x0020, 0x000e); + const DicomTag DicomTag::STUDY_INSTANCE_UID = DicomTag(0x0020, 0x000d); const DicomTag DicomTag::PIXEL_DATA = DicomTag(0x7fe0, 0x0010); + + const DicomTag DicomTag::INSTANCE_NUMBER = DicomTag(0x0020, 0x0013); + const DicomTag DicomTag::IMAGE_INDEX = DicomTag(0x0054, 0x1330); + + const DicomTag DicomTag::NUMBER_OF_SLICES = DicomTag(0x0054, 0x0081); + const DicomTag DicomTag::NUMBER_OF_FRAMES = DicomTag(0x0028, 0x0008); + const DicomTag DicomTag::CARDIAC_NUMBER_OF_IMAGES = DicomTag(0x0018, 0x1090); + const DicomTag DicomTag::IMAGES_IN_ACQUISITION = DicomTag(0x0020, 0x1002); + }
--- a/Core/DicomFormat/DicomTag.h Mon Sep 17 17:32:33 2012 +0200 +++ b/Core/DicomFormat/DicomTag.h Thu Sep 20 13:41:18 2012 +0200 @@ -58,14 +58,20 @@ friend std::ostream& operator<< (std::ostream& o, const DicomTag& tag); - // Alias for the most useful tags + // Aliases for the most useful tags static const DicomTag ACCESSION_NUMBER; + static const DicomTag SOP_INSTANCE_UID; + static const DicomTag PATIENT_ID; + static const DicomTag SERIES_INSTANCE_UID; + static const DicomTag STUDY_INSTANCE_UID; + static const DicomTag PIXEL_DATA; + + static const DicomTag INSTANCE_NUMBER; static const DicomTag IMAGE_INDEX; - static const DicomTag INSTANCE_UID; + static const DicomTag NUMBER_OF_SLICES; - static const DicomTag PATIENT_ID; - static const DicomTag SERIES_UID; - static const DicomTag STUDY_UID; - static const DicomTag PIXEL_DATA; + static const DicomTag NUMBER_OF_FRAMES; + static const DicomTag CARDIAC_NUMBER_OF_IMAGES; + static const DicomTag IMAGES_IN_ACQUISITION; }; }
--- a/OrthancServer/DicomIntegerPixelAccessor.cpp Mon Sep 17 17:32:33 2012 +0200 +++ b/OrthancServer/DicomIntegerPixelAccessor.cpp Thu Sep 20 13:41:18 2012 +0200 @@ -25,12 +25,19 @@ #endif #include "../Core/OrthancException.h" -#include "FromDcmtkBridge.h" #include <boost/lexical_cast.hpp> #include <limits> namespace Orthanc { + static const DicomTag COLUMNS(0x0028, 0x0011); + static const DicomTag ROWS(0x0028, 0x0010); + static const DicomTag SAMPLES_PER_PIXEL(0x0028, 0x0002); + static const DicomTag BITS_ALLOCATED(0x0028, 0x0100); + static const DicomTag BITS_STORED(0x0028, 0x0101); + static const DicomTag HIGH_BIT(0x0028, 0x0102); + static const DicomTag PIXEL_REPRESENTATION(0x0028, 0x0103); + DicomIntegerPixelAccessor::DicomIntegerPixelAccessor(const DicomMap& values, const void* pixelData, size_t size) : @@ -44,13 +51,13 @@ try { - width_ = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "Columns").AsString()); - height_ = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "Rows").AsString()); - samplesPerPixel_ = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "SamplesPerPixel").AsString()); - bitsAllocated = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "BitsAllocated").AsString()); - bitsStored = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "BitsStored").AsString()); - highBit = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "HighBit").AsString()); - pixelRepresentation = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "PixelRepresentation").AsString()); + width_ = boost::lexical_cast<unsigned int>(values.GetValue(COLUMNS).AsString()); + height_ = boost::lexical_cast<unsigned int>(values.GetValue(ROWS).AsString()); + samplesPerPixel_ = boost::lexical_cast<unsigned int>(values.GetValue(SAMPLES_PER_PIXEL).AsString()); + bitsAllocated = boost::lexical_cast<unsigned int>(values.GetValue(BITS_ALLOCATED).AsString()); + bitsStored = boost::lexical_cast<unsigned int>(values.GetValue(BITS_STORED).AsString()); + highBit = boost::lexical_cast<unsigned int>(values.GetValue(HIGH_BIT).AsString()); + pixelRepresentation = boost::lexical_cast<unsigned int>(values.GetValue(PIXEL_REPRESENTATION).AsString()); } catch (boost::bad_lexical_cast) { @@ -60,7 +67,7 @@ frame_ = 0; try { - numberOfFrames_ = boost::lexical_cast<unsigned int>(FromDcmtkBridge::GetValue(values, "NumberOfFrames").AsString()); + numberOfFrames_ = boost::lexical_cast<unsigned int>(values.GetValue(DicomTag::NUMBER_OF_FRAMES).AsString()); } catch (OrthancException) {
--- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp Mon Sep 17 17:32:33 2012 +0200 +++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp Thu Sep 20 13:41:18 2012 +0200 @@ -370,7 +370,7 @@ s.CopyTagIfExists(fields, DicomTag::PATIENT_ID); s.CopyTagIfExists(fields, DicomTag::ACCESSION_NUMBER); - s.CopyTagIfExists(fields, DicomTag::STUDY_UID); + s.CopyTagIfExists(fields, DicomTag::STUDY_INSTANCE_UID); Find(result, FindRootModel_Series, s); } @@ -384,8 +384,8 @@ s.CopyTagIfExists(fields, DicomTag::PATIENT_ID); s.CopyTagIfExists(fields, DicomTag::ACCESSION_NUMBER); - s.CopyTagIfExists(fields, DicomTag::STUDY_UID); - s.CopyTagIfExists(fields, DicomTag::SERIES_UID); + s.CopyTagIfExists(fields, DicomTag::STUDY_INSTANCE_UID); + s.CopyTagIfExists(fields, DicomTag::SERIES_INSTANCE_UID); Find(result, FindRootModel_Instance, s); } @@ -594,8 +594,8 @@ const DicomMap& findResult) { DicomMap simplified; - simplified.SetValue(DicomTag::STUDY_UID, findResult.GetValue(DicomTag::STUDY_UID)); - simplified.SetValue(DicomTag::SERIES_UID, findResult.GetValue(DicomTag::SERIES_UID)); + simplified.SetValue(DicomTag::STUDY_INSTANCE_UID, findResult.GetValue(DicomTag::STUDY_INSTANCE_UID)); + simplified.SetValue(DicomTag::SERIES_INSTANCE_UID, findResult.GetValue(DicomTag::SERIES_INSTANCE_UID)); Move(targetAet, simplified); } @@ -604,8 +604,8 @@ const std::string& seriesUid) { DicomMap map; - map.SetValue(DicomTag::STUDY_UID, studyUid); - map.SetValue(DicomTag::SERIES_UID, seriesUid); + map.SetValue(DicomTag::STUDY_INSTANCE_UID, studyUid); + map.SetValue(DicomTag::SERIES_INSTANCE_UID, seriesUid); Move(targetAet, map); } @@ -613,9 +613,9 @@ const DicomMap& findResult) { DicomMap simplified; - simplified.SetValue(DicomTag::STUDY_UID, findResult.GetValue(DicomTag::STUDY_UID)); - simplified.SetValue(DicomTag::SERIES_UID, findResult.GetValue(DicomTag::SERIES_UID)); - simplified.SetValue(DicomTag::INSTANCE_UID, findResult.GetValue(DicomTag::INSTANCE_UID)); + simplified.SetValue(DicomTag::STUDY_INSTANCE_UID, findResult.GetValue(DicomTag::STUDY_INSTANCE_UID)); + simplified.SetValue(DicomTag::SERIES_INSTANCE_UID, findResult.GetValue(DicomTag::SERIES_INSTANCE_UID)); + simplified.SetValue(DicomTag::SOP_INSTANCE_UID, findResult.GetValue(DicomTag::SOP_INSTANCE_UID)); Move(targetAet, simplified); } @@ -625,9 +625,9 @@ const std::string& instanceUid) { DicomMap map; - map.SetValue(DicomTag::STUDY_UID, studyUid); - map.SetValue(DicomTag::SERIES_UID, seriesUid); - map.SetValue(DicomTag::INSTANCE_UID, instanceUid); + map.SetValue(DicomTag::STUDY_INSTANCE_UID, studyUid); + map.SetValue(DicomTag::SERIES_INSTANCE_UID, seriesUid); + map.SetValue(DicomTag::SOP_INSTANCE_UID, instanceUid); Move(targetAet, map); }
--- a/OrthancServer/OrthancRestApi.cpp Mon Sep 17 17:32:33 2012 +0200 +++ b/OrthancServer/OrthancRestApi.cpp Thu Sep 20 13:41:18 2012 +0200 @@ -244,7 +244,7 @@ if ((m.GetValue(DicomTag::ACCESSION_NUMBER).AsString().size() <= 2 && m.GetValue(DicomTag::PATIENT_ID).AsString().size() <= 2) || - m.GetValue(DicomTag::STUDY_UID).AsString().size() <= 2) + m.GetValue(DicomTag::STUDY_INSTANCE_UID).AsString().size() <= 2) { return false; } @@ -300,7 +300,7 @@ return false; } m.CopyTagIfExists(studies.GetAnswer(j), DicomTag::PATIENT_ID); - m.CopyTagIfExists(studies.GetAnswer(j), DicomTag::STUDY_UID); + m.CopyTagIfExists(studies.GetAnswer(j), DicomTag::STUDY_INSTANCE_UID); DicomFindAnswers series; c.FindSeries(series, m);
--- a/OrthancServer/PrepareDatabase.sql Mon Sep 17 17:32:33 2012 +0200 +++ b/OrthancServer/PrepareDatabase.sql Thu Sep 20 13:41:18 2012 +0200 @@ -17,7 +17,8 @@ CREATE TABLE Series( uuid TEXT PRIMARY KEY, parentStudy TEXT REFERENCES Studies(uuid) ON DELETE CASCADE, - dicomSeries TEXT + dicomSeries TEXT, + numberOfInstances INTEGER ); CREATE TABLE Instances( @@ -27,7 +28,8 @@ fileUuid TEXT, fileSize INTEGER, jsonUuid TEXT, - distantAet TEXT + distantAet TEXT, + instanceIndex INTEGER ); CREATE TABLE MainDicomTags( @@ -55,6 +57,9 @@ CREATE INDEX DicomInstanceIndex ON Instances(dicomInstance); CREATE INDEX MainDicomTagsIndex ON MainDicomTags(uuid); +CREATE INDEX MainDicomTagsGroupElement ON MainDicomTags(tagGroup, tagElement); +CREATE INDEX MainDicomTagsValues ON MainDicomTags(value COLLATE BINARY); + CREATE INDEX ChangesIndex ON Changes(uuid); CREATE TRIGGER InstanceRemoved
--- a/OrthancServer/ServerIndex.cpp Mon Sep 17 17:32:33 2012 +0200 +++ b/OrthancServer/ServerIndex.cpp Thu Sep 20 13:41:18 2012 +0200 @@ -279,10 +279,11 @@ { std::string seriesUuid = Toolbox::GenerateUuid(); - SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO Series VALUES(?, ?, ?)"); + SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO Series VALUES(?, ?, ?, ?)"); s.BindString(0, seriesUuid); s.BindString(1, parentStudyUuid); s.BindString(2, dicomSeries); + s.BindNull(3); s.Run(); RecordChange("series", seriesUuid); @@ -474,9 +475,9 @@ boost::mutex::scoped_lock scoped_lock(mutex_); std::string dicomPatientId = dicomSummary.GetValue(DicomTag::PATIENT_ID).AsString(); - std::string dicomInstance = dicomSummary.GetValue(DicomTag::INSTANCE_UID).AsString(); - std::string dicomSeries = dicomSummary.GetValue(DicomTag::SERIES_UID).AsString(); - std::string dicomStudy = dicomSummary.GetValue(DicomTag::STUDY_UID).AsString(); + std::string dicomInstance = dicomSummary.GetValue(DicomTag::SOP_INSTANCE_UID).AsString(); + std::string dicomSeries = dicomSummary.GetValue(DicomTag::SERIES_INSTANCE_UID).AsString(); + std::string dicomStudy = dicomSummary.GetValue(DicomTag::STUDY_INSTANCE_UID).AsString(); try {
--- a/Resources/CMake/DownloadPackage.cmake Mon Sep 17 17:32:33 2012 +0200 +++ b/Resources/CMake/DownloadPackage.cmake Thu Sep 20 13:41:18 2012 +0200 @@ -55,6 +55,9 @@ endif() elseif ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") + # How to silently extract files using 7-zip + # http://superuser.com/questions/331148/7zip-command-line-extract-silently-quietly + FIND_PROGRAM(ZIP_EXECUTABLE 7z PATHS "$ENV{ProgramFiles}/7-Zip") if (("${TMP_EXTENSION}" STREQUAL "gz") OR ("${TMP_EXTENSION}" STREQUAL "tgz"))