# HG changeset patch # User Sebastien Jodogne # Date 1368620349 -7200 # Node ID aa50783f95501f719bdf1329296a1c623281774c # Parent 2b09d4ee86c6b1dad36d681f91c0cc04ee0501bd cardiopet diff -r 2b09d4ee86c6 -r aa50783f9550 Core/DicomFormat/DicomMap.cpp --- a/Core/DicomFormat/DicomMap.cpp Wed May 15 13:36:08 2013 +0200 +++ b/Core/DicomFormat/DicomMap.cpp Wed May 15 14:19:09 2013 +0200 @@ -76,9 +76,11 @@ DicomTag(0x0018, 0x0024), // SequenceName DicomTag(0x0018, 0x1030), // ProtocolName DicomTag(0x0020, 0x0011), // SeriesNumber - //DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES, + DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES, DICOM_TAG_IMAGES_IN_ACQUISITION, + DICOM_TAG_NUMBER_OF_TEMPORAL_POSITIONS, DICOM_TAG_NUMBER_OF_SLICES, + DICOM_TAG_NUMBER_OF_TIME_SLICES, DICOM_TAG_SERIES_INSTANCE_UID }; @@ -90,6 +92,7 @@ DICOM_TAG_IMAGE_INDEX, DICOM_TAG_INSTANCE_NUMBER, DICOM_TAG_NUMBER_OF_FRAMES, + DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER, DICOM_TAG_SOP_INSTANCE_UID }; diff -r 2b09d4ee86c6 -r aa50783f9550 Core/DicomFormat/DicomTag.h --- a/Core/DicomFormat/DicomTag.h Wed May 15 13:36:08 2013 +0200 +++ b/Core/DicomFormat/DicomTag.h Wed May 15 14:19:09 2013 +0200 @@ -95,6 +95,7 @@ static const DicomTag DICOM_TAG_INSTANCE_NUMBER(0x0020, 0x0013); static const DicomTag DICOM_TAG_NUMBER_OF_SLICES(0x0054, 0x0081); + static const DicomTag DICOM_TAG_NUMBER_OF_TIME_SLICES(0x0054, 0x0101); static const DicomTag DICOM_TAG_NUMBER_OF_FRAMES(0x0028, 0x0008); static const DicomTag DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES(0x0018, 0x1090); static const DicomTag DICOM_TAG_IMAGES_IN_ACQUISITION(0x0020, 0x1002); @@ -105,4 +106,8 @@ static const DicomTag DICOM_TAG_SOP_CLASS_UID(0x0008, 0x0016); static const DicomTag DICOM_TAG_MEDIA_STORAGE_SOP_CLASS_UID(0x0002, 0x0002); static const DicomTag DICOM_TAG_MEDIA_STORAGE_SOP_INSTANCE_UID(0x0002, 0x0003); + + // DICOM tags used for MRI (thanks to Will Ryder) + static const DicomTag DICOM_TAG_NUMBER_OF_TEMPORAL_POSITIONS(0x0020, 0x0105); + static const DicomTag DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER(0x0020, 0x0100); } diff -r 2b09d4ee86c6 -r aa50783f9550 NEWS --- a/NEWS Wed May 15 13:36:08 2013 +0200 +++ b/NEWS Wed May 15 14:19:09 2013 +0200 @@ -1,6 +1,10 @@ Pending changes in the mainline =============================== +* "LastUpdate" metadata for patients, studies and series +* Improved support of series with temporal positions +* Fixes for Red Hat and Debian packaging +* Fixes for boost::thread, as reported by Cyril Paulus Version 0.5.2 (2013/05/07) diff -r 2b09d4ee86c6 -r aa50783f9550 OrthancServer/ServerIndex.cpp --- a/OrthancServer/ServerIndex.cpp Wed May 15 13:36:08 2013 +0200 +++ b/OrthancServer/ServerIndex.cpp Wed May 15 14:19:09 2013 +0200 @@ -240,6 +240,46 @@ } + static void ComputeExpectedNumberOfInstances(DatabaseWrapper& db, + int64_t series, + const DicomMap& dicomSummary) + { + const DicomValue* value; + const DicomValue* value2; + + try + { + if ((value = dicomSummary.TestAndGetValue(DICOM_TAG_IMAGES_IN_ACQUISITION)) != NULL && + (value2 = dicomSummary.TestAndGetValue(DICOM_TAG_NUMBER_OF_TEMPORAL_POSITIONS)) != NULL) + { + // Patch for series with temporal positions thanks to Will Ryder + int64_t imagesInAcquisition = boost::lexical_cast(value->AsString()); + int64_t countTemporalPositions = boost::lexical_cast(value2->AsString()); + std::string expected = boost::lexical_cast(imagesInAcquisition * countTemporalPositions); + db.SetMetadata(series, MetadataType_Series_ExpectedNumberOfInstances, expected); + } + + else if ((value = dicomSummary.TestAndGetValue(DICOM_TAG_NUMBER_OF_SLICES)) != NULL && + (value2 = dicomSummary.TestAndGetValue(DICOM_TAG_NUMBER_OF_TIME_SLICES)) != NULL) + { + // Support of Cardio-PET images + int64_t numberOfSlices = boost::lexical_cast(value->AsString()); + int64_t numberOfTimeSlices = boost::lexical_cast(value2->AsString()); + std::string expected = boost::lexical_cast(numberOfSlices * numberOfTimeSlices); + db.SetMetadata(series, MetadataType_Series_ExpectedNumberOfInstances, expected); + } + + else if ((value = dicomSummary.TestAndGetValue(DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES)) != NULL) + { + db.SetMetadata(series, MetadataType_Series_ExpectedNumberOfInstances, value->AsString()); + } + } + catch (boost::bad_lexical_cast) + { + } + } + + ServerIndex::ServerIndex(ServerContext& context, const std::string& dbPath) : maximumStorageSize_(0), @@ -449,12 +489,7 @@ if (isNewSeries) { - if ((value = dicomSummary.TestAndGetValue(DICOM_TAG_NUMBER_OF_SLICES)) != NULL || - (value = dicomSummary.TestAndGetValue(DICOM_TAG_IMAGES_IN_ACQUISITION)) != NULL || - (value = dicomSummary.TestAndGetValue(DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES)) != NULL) - { - db_->SetMetadata(series, MetadataType_Series_ExpectedNumberOfInstances, value->AsString()); - } + ComputeExpectedNumberOfInstances(*db_, series, dicomSummary); } // Check whether the series of this new instance is now completed diff -r 2b09d4ee86c6 -r aa50783f9550 THANKS --- a/THANKS Wed May 15 13:36:08 2013 +0200 +++ b/THANKS Wed May 15 14:19:09 2013 +0200 @@ -13,6 +13,8 @@ * Cyril Paulus (cyril.paulus@student.ulg.ac.be), for the build process and suggestions about the REST API. +* Will Ryder (will.ryder@sydney.edu.au), for improvements with the + handling of series with temporal positions (fMRI). Artwork @@ -30,4 +32,10 @@ ------ * Mathieu Malaterre (mathieu.malaterre@gmail.com), for sponsoring Orthanc. -* Andreas Tille (andreas@an3as.eu), for help about Debian packaging. +* Andreas Tille (andreas@an3as.eu), for help about packaging. + + +Fedora and Red Hat +------------------ + +* Mario Ceresa (mrceresa@gmail.com), for help about packaging.