comparison OrthancServer/OrthancRestApi/OrthancRestArchive.cpp @ 1623:76ed4cf74bb5

Add ".dcm" suffix to files in ZIP archives
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 18 Sep 2015 10:39:43 +0200
parents f938f7779bcb
children 784a6b92d2f1
comparison
equal deleted inserted replaced
1622:0b8e62bd9c48 1623:76ed4cf74bb5
197 break; 197 break;
198 198
199 case ResourceType_Series: 199 case ResourceType_Series:
200 { 200 {
201 // Create a filename prefix, depending on the modality 201 // Create a filename prefix, depending on the modality
202 char format[16] = "%08d"; 202 char format[24] = "%08d.dcm";
203 203
204 if (resource["MainDicomTags"].isMember("Modality")) 204 if (resource["MainDicomTags"].isMember("Modality"))
205 { 205 {
206 std::string modality = resource["MainDicomTags"]["Modality"].asString(); 206 std::string modality = resource["MainDicomTags"]["Modality"].asString();
207 207
208 if (modality.size() == 1) 208 if (modality.size() == 1)
209 { 209 {
210 snprintf(format, sizeof(format) - 1, "%c%%07d", toupper(modality[0])); 210 snprintf(format, sizeof(format) - 1, "%c%%07d.dcm", toupper(modality[0]));
211 } 211 }
212 else if (modality.size() >= 2) 212 else if (modality.size() >= 2)
213 { 213 {
214 snprintf(format, sizeof(format) - 1, "%c%c%%06d", toupper(modality[0]), toupper(modality[1])); 214 snprintf(format, sizeof(format) - 1, "%c%c%%06d.dcm", toupper(modality[0]), toupper(modality[1]));
215 } 215 }
216 } 216 }
217 217
218 char filename[16]; 218 char filename[24];
219 219
220 for (Json::Value::ArrayIndex i = 0; i < resource["Instances"].size(); i++) 220 for (Json::Value::ArrayIndex i = 0; i < resource["Instances"].size(); i++)
221 { 221 {
222 snprintf(filename, sizeof(filename) - 1, format, i); 222 snprintf(filename, sizeof(filename) - 1, format, i);
223 223