diff Core/DicomParsing/ParsedDicomFile.cpp @ 2394:75c779ca948c

fix compilation without Web server
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Aug 2017 16:23:10 +0200
parents 7284093111b0
children e4045b3c9772
line wrap: on
line diff
--- a/Core/DicomParsing/ParsedDicomFile.cpp	Wed Aug 30 13:27:05 2017 +0200
+++ b/Core/DicomParsing/ParsedDicomFile.cpp	Wed Aug 30 16:23:10 2017 +0200
@@ -146,9 +146,6 @@
 #endif
 
 
-static const char* CONTENT_TYPE_OCTET_STREAM = "application/octet-stream";
-
-
 
 namespace Orthanc
 {
@@ -159,6 +156,33 @@
   };
 
 
+#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1
+  static const char* CONTENT_TYPE_OCTET_STREAM = "application/octet-stream";
+
+  static void ParseTagAndGroup(DcmTagKey& key,
+                               const std::string& tag)
+  {
+    DicomTag t = FromDcmtkBridge::ParseTag(tag);
+    key = DcmTagKey(t.GetGroup(), t.GetElement());
+  }
+
+  
+  static unsigned int GetPixelDataBlockCount(DcmPixelData& pixelData,
+                                             E_TransferSyntax transferSyntax)
+  {
+    DcmPixelSequence* pixelSequence = NULL;
+    if (pixelData.getEncapsulatedRepresentation
+        (transferSyntax, NULL, pixelSequence).good() && pixelSequence)
+    {
+      return pixelSequence->card();
+    }
+    else
+    {
+      return 1;
+    }
+  }
+
+  
   static void SendPathValueForDictionary(RestApiOutput& output,
                                          DcmItem& dicom)
   {
@@ -178,33 +202,6 @@
     output.AnswerJson(v);
   }
 
-  static inline uint16_t GetCharValue(char c)
-  {
-    if (c >= '0' && c <= '9')
-      return c - '0';
-    else if (c >= 'a' && c <= 'f')
-      return c - 'a' + 10;
-    else if (c >= 'A' && c <= 'F')
-      return c - 'A' + 10;
-    else
-      return 0;
-  }
-
-  static inline uint16_t GetTagValue(const char* c)
-  {
-    return ((GetCharValue(c[0]) << 12) + 
-            (GetCharValue(c[1]) << 8) + 
-            (GetCharValue(c[2]) << 4) + 
-            GetCharValue(c[3]));
-  }
-
-  static void ParseTagAndGroup(DcmTagKey& key,
-                               const std::string& tag)
-  {
-    DicomTag t = FromDcmtkBridge::ParseTag(tag);
-    key = DcmTagKey(t.GetGroup(), t.GetElement());
-  }
-
 
   static void SendSequence(RestApiOutput& output,
                            DcmSequenceOfItems& sequence)
@@ -221,22 +218,6 @@
   }
 
 
-  static unsigned int GetPixelDataBlockCount(DcmPixelData& pixelData,
-                                             E_TransferSyntax transferSyntax)
-  {
-    DcmPixelSequence* pixelSequence = NULL;
-    if (pixelData.getEncapsulatedRepresentation
-        (transferSyntax, NULL, pixelSequence).good() && pixelSequence)
-    {
-      return pixelSequence->card();
-    }
-    else
-    {
-      return 1;
-    }
-  }
-
-
   namespace
   {
     class DicomFieldStream : public IHttpStreamAnswer
@@ -413,7 +394,6 @@
   }
 
 
-
   static void SendPathValueForLeaf(RestApiOutput& output,
                                    const std::string& tag,
                                    DcmItem& dicom,
@@ -441,7 +421,32 @@
       output.AnswerStream(stream);
     }
   }
+#endif
 
+  
+  static inline uint16_t GetCharValue(char c)
+  {
+    if (c >= '0' && c <= '9')
+      return c - '0';
+    else if (c >= 'a' && c <= 'f')
+      return c - 'a' + 10;
+    else if (c >= 'A' && c <= 'F')
+      return c - 'A' + 10;
+    else
+      return 0;
+  }
+
+  
+  static inline uint16_t GetTagValue(const char* c)
+  {
+    return ((GetCharValue(c[0]) << 12) + 
+            (GetCharValue(c[1]) << 8) + 
+            (GetCharValue(c[2]) << 4) + 
+            GetCharValue(c[3]));
+  }
+
+
+#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1
   void ParsedDicomFile::SendPathValue(RestApiOutput& output,
                                       const UriComponents& uri)
   {
@@ -498,7 +503,8 @@
       SendPathValueForLeaf(output, uri.back(), *dicom, transferSyntax);
     }
   }
-
+#endif
+  
 
   void ParsedDicomFile::Remove(const DicomTag& tag)
   {
@@ -782,6 +788,7 @@
   }
 
     
+#if ORTHANC_ENABLE_CIVETWEB == 1 || ORTHANC_ENABLE_MONGOOSE == 1
   void ParsedDicomFile::Answer(RestApiOutput& output)
   {
     std::string serialized;
@@ -790,7 +797,7 @@
       output.AnswerBuffer(serialized, CONTENT_TYPE_OCTET_STREAM);
     }
   }
-
+#endif
 
 
   bool ParsedDicomFile::GetTagValue(std::string& value,