changeset 433:aa50783f9550

cardiopet
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 15 May 2013 14:19:09 +0200
parents 2b09d4ee86c6
children ccf3a0a43dac
files Core/DicomFormat/DicomMap.cpp Core/DicomFormat/DicomTag.h NEWS OrthancServer/ServerIndex.cpp THANKS
diffstat 5 files changed, 63 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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
   };
 
--- 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);
 }
--- 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)
--- 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<int64_t>(value->AsString());
+        int64_t countTemporalPositions = boost::lexical_cast<int64_t>(value2->AsString());
+        std::string expected = boost::lexical_cast<std::string>(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<int64_t>(value->AsString());
+        int64_t numberOfTimeSlices = boost::lexical_cast<int64_t>(value2->AsString());
+        std::string expected = boost::lexical_cast<std::string>(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
--- 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.