changeset 1383:5c11c4e728eb query-retrieve

integration mainline->query-retrieve
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 May 2015 14:46:55 +0200
parents 21a2929e541d (current diff) 1cd2e09cb0e5 (diff)
children 772c8507c68d
files NEWS OrthancServer/OrthancFindRequestHandler.cpp OrthancServer/OrthancRestApi/OrthancRestResources.cpp Resources/Configuration.json
diffstat 27 files changed, 278 insertions(+), 288 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu May 28 12:19:26 2015 +0200
+++ b/NEWS	Fri May 29 14:46:55 2015 +0200
@@ -16,6 +16,7 @@
 * Speed-up in Orthanc Explorer for large amount of images
 * Speed-up of the C-Find SCP server of Orthanc
 * Allow replacing PatientID/StudyInstanceUID/SeriesInstanceUID from Lua scripts
+* Option "CaseSensitivePN" to enable case-insensitive C-Find SCP
 
 Fixes
 -----
--- a/OrthancServer/DicomFindQuery.cpp	Thu May 28 12:19:26 2015 +0200
+++ b/OrthancServer/DicomFindQuery.cpp	Fri May 29 14:46:55 2015 +0200
@@ -156,10 +156,19 @@
     boost::regex pattern_;
 
   public:
-    WildcardConstraint(const std::string& wildcard)
+    WildcardConstraint(const std::string& wildcard,
+                       bool caseSensitive)
     {
-      pattern_ = boost::regex(Toolbox::WildcardToRegularExpression(wildcard),
-                              boost::regex::icase /* case insensitive search */);
+      std::string re = Toolbox::WildcardToRegularExpression(wildcard);
+
+      if (caseSensitive)
+      {
+        pattern_ = boost::regex(re);
+      }
+      else
+      {
+        pattern_ = boost::regex(re, boost::regex::icase /* case insensitive search */);
+      }
     }
 
     virtual bool Apply(const std::string& value) const
@@ -233,8 +242,11 @@
 
 
   void DicomFindQuery::SetConstraint(const DicomTag& tag,
-                                     const std::string& constraint)
+                                     const std::string& constraint,
+                                     bool caseSensitivePN)
   {
+    bool sensitive = (FromDcmtkBridge::IsPNValueRepresentation(tag) ? caseSensitivePN : true);
+
     // http://www.itk.org/Wiki/DICOM_QueryRetrieve_Explained
     // http://dicomiseasy.blogspot.be/2012/01/dicom-queryretrieve-part-i.html  
 
@@ -249,7 +261,7 @@
     else if (constraint.find('*') != std::string::npos ||
              constraint.find('?') != std::string::npos)
     {
-      AssignConstraint(tag, new WildcardConstraint(constraint));
+      AssignConstraint(tag, new WildcardConstraint(constraint, sensitive));
     }
     else
     {
@@ -284,7 +296,7 @@
        * (0020,000E) UI SeriesInstanceUID  => Case-sensitive
       **/
 
-      AssignConstraint(tag, new ValueConstraint(constraint, FromDcmtkBridge::IsPNValueRepresentation(tag)));
+      AssignConstraint(tag, new ValueConstraint(constraint, sensitive));
     }
   }
 
--- a/OrthancServer/DicomFindQuery.h	Thu May 28 12:19:26 2015 +0200
+++ b/OrthancServer/DicomFindQuery.h	Fri May 29 14:46:55 2015 +0200
@@ -91,7 +91,8 @@
     }
 
     void SetConstraint(const DicomTag& tag,
-                       const std::string& constraint);
+                       const std::string& constraint,
+                       bool caseSensitivePN);
 
     virtual bool RestrictIdentifier(std::string& value,
                                     DicomTag identifier) const;
--- a/OrthancServer/OrthancFindRequestHandler.cpp	Thu May 28 12:19:26 2015 +0200
+++ b/OrthancServer/OrthancFindRequestHandler.cpp	Fri May 29 14:46:55 2015 +0200
@@ -231,6 +231,8 @@
 
     // ModalityManufacturer manufacturer = modality.GetManufacturer();
 
+    bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false);
+
 
     /**
      * Retrieve the query level.
@@ -293,7 +295,7 @@
       }
       else
       {
-        findQuery.SetConstraint(tag, value);
+        findQuery.SetConstraint(tag, value, caseSensitivePN);
       }
     }
 
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Thu May 28 12:19:26 2015 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Fri May 29 14:46:55 2015 +0200
@@ -859,7 +859,8 @@
         request.isMember("Level") &&
         request.isMember("Query") &&
         request["Level"].type() == Json::stringValue &&
-        request["Query"].type() == Json::objectValue)
+        request["Query"].type() == Json::objectValue &&
+        (!request.isMember("CaseSensitive") || request["CaseSensitive"].type() == Json::booleanValue))
     {
       bool expand = false;
       if (request.isMember("Expand"))
@@ -867,6 +868,12 @@
         expand = request["Expand"].asBool();
       }
 
+      bool caseSensitive = false;
+      if (request.isMember("CaseSensitive"))
+      {
+        caseSensitive = request["CaseSensitive"].asBool();
+      }
+
       std::string level = request["Level"].asString();
 
       DicomFindQuery query;
@@ -881,7 +888,8 @@
         }
 
         query.SetConstraint(FromDcmtkBridge::ParseTag(members[i]), 
-                            request["Query"][members[i]].asString());
+                            request["Query"][members[i]].asString(),
+                            caseSensitive);
       }
       
       std::list<std::string> resources;
--- a/Plugins/Samples/Basic/Plugin.c	Thu May 28 12:19:26 2015 +0200
+++ b/Plugins/Samples/Basic/Plugin.c	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Plugins/Samples/GdcmDecoding/OrthancContext.cpp	Thu May 28 12:19:26 2015 +0200
+++ b/Plugins/Samples/GdcmDecoding/OrthancContext.cpp	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Plugins/Samples/GdcmDecoding/OrthancContext.h	Thu May 28 12:19:26 2015 +0200
+++ b/Plugins/Samples/GdcmDecoding/OrthancContext.h	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Plugins/Samples/GdcmDecoding/Plugin.cpp	Thu May 28 12:19:26 2015 +0200
+++ b/Plugins/Samples/GdcmDecoding/Plugin.cpp	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Plugins/Samples/ServeFolders/Plugin.cpp	Thu May 28 12:19:26 2015 +0200
+++ b/Plugins/Samples/ServeFolders/Plugin.cpp	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Plugins/Samples/StorageArea/Plugin.cpp	Thu May 28 12:19:26 2015 +0200
+++ b/Plugins/Samples/StorageArea/Plugin.cpp	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Plugins/Samples/WebSkeleton/Configuration.h	Thu May 28 12:19:26 2015 +0200
+++ b/Plugins/Samples/WebSkeleton/Configuration.h	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Plugins/Samples/WebSkeleton/Framework/EmbedResources.py	Thu May 28 12:19:26 2015 +0200
+++ b/Plugins/Samples/WebSkeleton/Framework/EmbedResources.py	Fri May 29 14:46:55 2015 +0200
@@ -7,18 +7,6 @@
 # published by the Free Software Foundation, either version 3 of the
 # License, or (at your option) any later version.
 #
-# In addition, as a special exception, the copyright holders of this
-# program give permission to link the code of its release with the
-# OpenSSL project's "OpenSSL" library (or with modified versions of it
-# that use the same license as the "OpenSSL" library), and distribute
-# the linked executables. You must obey the GNU General Public License
-# in all respects for all of the code used other than "OpenSSL". If you
-# modify file(s) with this exception, you may extend this exception to
-# your version of the file(s), but you are not obligated to do so. If
-# you do not wish to do so, delete this exception statement from your
-# version. If you delete this exception statement from all source files
-# in the program, then also delete it here.
-# 
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--- a/Plugins/Samples/WebSkeleton/Framework/Framework.cmake	Thu May 28 12:19:26 2015 +0200
+++ b/Plugins/Samples/WebSkeleton/Framework/Framework.cmake	Fri May 29 14:46:55 2015 +0200
@@ -6,18 +6,6 @@
 # modify it under the terms of the GNU General Public License as
 # published by the Free Software Foundation, either version 3 of the
 # License, or (at your option) any later version.
-#
-# In addition, as a special exception, the copyright holders of this
-# program give permission to link the code of its release with the
-# OpenSSL project's "OpenSSL" library (or with modified versions of it
-# that use the same license as the "OpenSSL" library), and distribute
-# the linked executables. You must obey the GNU General Public License
-# in all respects for all of the code used other than "OpenSSL". If you
-# modify file(s) with this exception, you may extend this exception to
-# your version of the file(s), but you are not obligated to do so. If
-# you do not wish to do so, delete this exception statement from your
-# version. If you delete this exception statement from all source files
-# in the program, then also delete it here.
 # 
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
--- a/Plugins/Samples/WebSkeleton/Framework/Plugin.cpp	Thu May 28 12:19:26 2015 +0200
+++ b/Plugins/Samples/WebSkeleton/Framework/Plugin.cpp	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Resources/CMake/Compiler.cmake	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/CMake/Compiler.cmake	Fri May 29 14:46:55 2015 +0200
@@ -70,6 +70,16 @@
   if (${CMAKE_COMPILER_IS_GNUCXX})
     # This is a patch for MinGW64
     SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
+
+    CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD)
+    if (HAVE_WIN_PTHREAD)
+      # This line is necessary to compile with recent versions of MinGW,
+      # otherwise "libwinpthread-1.dll" is not statically linked.
+      SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic")
+      add_definitions(-DHAVE_WIN_PTHREAD=1)
+    else()
+      add_definitions(-DHAVE_WIN_PTHREAD=0)
+    endif()
   endif()
 
 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
--- a/Resources/CMake/DcmtkConfiguration.cmake	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/CMake/DcmtkConfiguration.cmake	Fri May 29 14:46:55 2015 +0200
@@ -118,6 +118,12 @@
         )
     endif()
 
+    # This patch improves speed, even for Windows
+    execute_process(
+      COMMAND patch -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-linux-speed.patch
+      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+      )
+
   endif()
 
   list(REMOVE_ITEM DCMTK_SOURCES 
--- a/Resources/CMake/GoogleLogConfiguration.cmake	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/CMake/GoogleLogConfiguration.cmake	Fri May 29 14:46:55 2015 +0200
@@ -76,8 +76,10 @@
         )
     endif()
 
+    # Patches for MinGW
     execute_process(
-      COMMAND patch -N port.h ${ORTHANC_ROOT}/Resources/Patches/glog-port-h.diff 
+      #COMMAND patch -N port.h ${ORTHANC_ROOT}/Resources/Patches/glog-port-h.diff 
+      COMMAND patch -N port.h ${ORTHANC_ROOT}/Resources/Patches/glog-port-h-v2.diff 
       WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows
       )
     execute_process(
@@ -164,3 +166,11 @@
 
   link_libraries(glog)
 endif()
+
+
+CHECK_INCLUDE_FILES(sec_api/string_s.h HAVE_SECURE_STRING_EXTENSIONS)
+if (HAVE_SECURE_STRING_EXTENSIONS)
+  add_definitions(-DHAVE_SECURE_STRING_EXTENSIONS=1)
+else()
+  add_definitions(-DHAVE_SECURE_STRING_EXTENSIONS=0)
+endif()
--- a/Resources/Configuration.json	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/Configuration.json	Fri May 29 14:46:55 2015 +0200
@@ -227,5 +227,10 @@
   // Maximum number of query/retrieve DICOM requests that are
   // maintained by Orthanc. The least recently used requests get
   // deleted as new requests are issued.
-  "QueryRetrieveSize" : 10
+  "QueryRetrieveSize" : 10,
+
+  // When handling a C-Find SCP request, setting this flag to "false"
+  // will enable case-insensitive match for PN value representation
+  // (such as PatientName). By default, the search is case-insensitive.
+  "CaseSensitivePN" : false
 }
--- a/Resources/EmbedResources.py	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/EmbedResources.py	Fri May 29 14:46:55 2015 +0200
@@ -229,6 +229,10 @@
         cpp.write("0x%02x" % c)
         pos += 1
 
+    # Zero-size array are disallowed, so we put one single void character in it.
+    if pos == 0:
+        cpp.write('  0')
+
     cpp.write('  };\n')
     cpp.write('    static const size_t resource%dSize = %d;\n' % (item['Index'], pos))
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Patches/glog-port-h-v2.diff	Fri May 29 14:46:55 2015 +0200
@@ -0,0 +1,52 @@
+124,130c124,146
+< // ----------------------------------- THREADS
+< typedef DWORD pthread_t;
+< typedef DWORD pthread_key_t;
+< typedef LONG pthread_once_t;
+< enum { PTHREAD_ONCE_INIT = 0 };   // important that this be 0! for SpinLock
+< #define pthread_self  GetCurrentThreadId
+< #define pthread_equal(pthread_t_1, pthread_t_2)  ((pthread_t_1)==(pthread_t_2))
+---
+> // ----------------------------------- SECURE STRINGS
+> 
+> #if HAVE_SECURE_STRING_EXTENSIONS == 0
+> // Emulation of "localtime_s" and "strerror_s" for old versions of MinGW
+> inline int localtime_s(tm * _tm, const time_t * time)
+> {
+>   tm * posix_local_time_struct = localtime(time);
+>   if (posix_local_time_struct == NULL) 
+>   {
+>     return 1;
+>   }
+> 
+>   *_tm = *posix_local_time_struct;
+> 
+>   return 0;
+> }
+> 
+> inline char* strerror_s(char* buf, size_t buflen, int errnum) 
+> {
+>   const char* str = strerror(errnum);
+>   return strncpy(buf, str, buflen - 1);
+> }
+> #endif
+131a148,149
+> 
+> #if !defined(__MINGW32__) || HAVE_SECURE_STRING_EXTENSIONS == 0
+135a154,155
+> #endif
+> 
+140a161,173
+> 
+> 
+> // ----------------------------------- THREADS
+> 
+> #if !defined(__MINGW32__) || HAVE_WIN_PTHREAD == 0
+> typedef DWORD pthread_t;
+> typedef DWORD pthread_key_t;
+> typedef LONG pthread_once_t;
+> enum { PTHREAD_ONCE_INIT = 0 };   // important that this be 0! for SpinLock
+> #define pthread_self  GetCurrentThreadId
+> #define pthread_equal(pthread_t_1, pthread_t_2)  ((pthread_t_1)==(pthread_t_2))
+> #endif
+> 
--- a/Resources/Samples/Lua/CallWebService.js	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/Samples/Lua/CallWebService.js	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Resources/Samples/OrthancClient/Basic/main.cpp	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/Samples/OrthancClient/Basic/main.cpp	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Resources/Samples/OrthancClient/Vtk/main.cpp	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/Samples/OrthancClient/Vtk/main.cpp	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Resources/Samples/WebApplications/DrawingDicomizer.js	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/Samples/WebApplications/DrawingDicomizer.js	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
 
--- a/Resources/Samples/WebApplications/DrawingDicomizer/orthanc.js	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/Samples/WebApplications/DrawingDicomizer/orthanc.js	Fri May 29 14:46:55 2015 +0200
@@ -3,27 +3,21 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
+
 function guid4Block() {
   return Math.floor((1 + Math.random()) * 0x10000)
     .toString(16)
--- a/Resources/Samples/WebApplications/NodeToolbox.js	Thu May 28 12:19:26 2015 +0200
+++ b/Resources/Samples/WebApplications/NodeToolbox.js	Fri May 29 14:46:55 2015 +0200
@@ -3,25 +3,18 @@
  * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics
  * Department, University Hospital of Liege, Belgium
  *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/