comparison OrthancFramework/Sources/Images/NumpyWriter.cpp @ 5289:b466ca3d17bb

fix compatibility of NumpyWriter with wasm
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 May 2023 16:35:28 +0200
parents 0ea402b4d901
children 48b8dae6dc77
comparison
equal deleted inserted replaced
5288:dc8fe64a452f 5289:b466ca3d17bb
152 ChunkedBuffer& source, 152 ChunkedBuffer& source,
153 bool compress) 153 bool compress)
154 { 154 {
155 if (compress) 155 if (compress)
156 { 156 {
157 #if ORTHANC_ENABLE_ZLIB == 1 157 #if (ORTHANC_ENABLE_ZLIB == 1) && (ORTHANC_SANDBOXED == 0)
158 // This is the default name of the first array if arrays are 158 // This is the default name of the first array if arrays are
159 // specified as positional arguments in "numpy.savez()" 159 // specified as positional arguments in "numpy.savez()"
160 // https://numpy.org/doc/stable/reference/generated/numpy.savez.html 160 // https://numpy.org/doc/stable/reference/generated/numpy.savez.html
161 const char* ARRAY_NAME = "arr_0"; 161 const char* ARRAY_NAME = "arr_0";
162 162
170 writer.Open(); 170 writer.Open();
171 writer.OpenFile(ARRAY_NAME); 171 writer.OpenFile(ARRAY_NAME);
172 writer.Write(uncompressed); 172 writer.Write(uncompressed);
173 writer.Close(); 173 writer.Close();
174 #else 174 #else
175 throw OrthancException(ErrorCode_InternalError, "Orthanc was compiled without support for zlib"); 175 throw OrthancException(ErrorCode_InternalError, "Orthanc was compiled without support for ZIP");
176 #endif 176 #endif
177 } 177 }
178 else 178 else
179 { 179 {
180 source.Flatten(target); 180 source.Flatten(target);