Mercurial > hg > orthanc
comparison OrthancServer/OrthancRestApi2.cpp @ 214:03817919169b
list of frames
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Nov 2012 11:11:53 +0100 |
parents | 4ce7fdcc8879 |
children | c07170f3f4f7 |
comparison
equal
deleted
inserted
replaced
213:4ce7fdcc8879 | 214:03817919169b |
---|---|
191 call.GetOutput().AnswerJson(full); | 191 call.GetOutput().AnswerJson(full); |
192 } | 192 } |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 | |
197 static void ListFrames(RestApi::GetCall& call) | |
198 { | |
199 RETRIEVE_CONTEXT(call); | |
200 | |
201 Json::Value instance; | |
202 if (context.GetIndex().LookupResource(instance, call.GetUriComponent("id", ""), ResourceType_Instance)) | |
203 { | |
204 unsigned int numberOfFrames = 1; | |
205 | |
206 try | |
207 { | |
208 Json::Value tmp = instance["MainDicomTags"]["NumberOfFrames"]; | |
209 numberOfFrames = boost::lexical_cast<unsigned int>(tmp.asString()); | |
210 } | |
211 catch (...) | |
212 { | |
213 } | |
214 | |
215 Json::Value result = Json::arrayValue; | |
216 for (unsigned int i = 0; i < numberOfFrames; i++) | |
217 { | |
218 result.append(i); | |
219 } | |
220 | |
221 call.GetOutput().AnswerJson(result); | |
222 } | |
223 } | |
224 | |
196 | 225 |
197 | 226 |
198 // DICOM bridge ------------------------------------------------------------- | 227 // DICOM bridge ------------------------------------------------------------- |
199 | 228 |
200 static void ListModalities(RestApi::GetCall& call) | 229 static void ListModalities(RestApi::GetCall& call) |
244 Register("/studies/{id}", GetSingleResource<ResourceType_Study>); | 273 Register("/studies/{id}", GetSingleResource<ResourceType_Study>); |
245 | 274 |
246 Register("/instances/{id}/file", GetInstanceFile); | 275 Register("/instances/{id}/file", GetInstanceFile); |
247 Register("/instances/{id}/tags", GetInstanceTags<false>); | 276 Register("/instances/{id}/tags", GetInstanceTags<false>); |
248 Register("/instances/{id}/simplified-tags", GetInstanceTags<true>); | 277 Register("/instances/{id}/simplified-tags", GetInstanceTags<true>); |
278 Register("/instances/{id}/frames", ListFrames); | |
249 | 279 |
250 // TODO : "content", "frames" | 280 // TODO : "content", "frames" |
251 } | 281 } |
252 } | 282 } |