# HG changeset patch # User Sebastien Jodogne # Date 1449737626 -3600 # Node ID 5fdcb04afb0de3d386a06cedbc9a7b368f949498 # Parent 85609146eb16414d756cb3eb289ec8583b8ac636 extension: retrieve all frames if none is specified diff -r 85609146eb16 -r 5fdcb04afb0d Plugin/Plugin.cpp --- a/Plugin/Plugin.cpp Wed Dec 09 17:13:09 2015 +0100 +++ b/Plugin/Plugin.cpp Thu Dec 10 09:53:46 2015 +0100 @@ -196,6 +196,7 @@ Register(root, "studies/([^/]*)/series/([^/]*)/instances/([^/]*)/bulk/(.*)", Protect); Register(root, "studies/([^/]*)/series/([^/]*)/instances/([^/]*)/metadata", Protect); Register(root, "studies/([^/]*)/series/([^/]*)/metadata", Protect); + Register(root, "studies/([^/]*)/series/([^/]*)/instances/([^/]*)/frames", Protect); Register(root, "studies/([^/]*)/series/([^/]*)/instances/([^/]*)/frames/([^/]*)", Protect); } else diff -r 85609146eb16 -r 5fdcb04afb0d Plugin/WadoRs.cpp --- a/Plugin/WadoRs.cpp Wed Dec 09 17:13:09 2015 +0100 +++ b/Plugin/WadoRs.cpp Thu Dec 10 09:53:46 2015 +0100 @@ -783,9 +783,9 @@ { frames.clear(); - if (request->groupsCount < 3) + if (request->groupsCount <= 3 || + request->groups[3] == NULL) { - frames.push_back(0); return; } @@ -889,7 +889,7 @@ const OrthancPluginHttpRequest* request, const OrthancPlugins::ParsedDicomFile& dicom, const gdcm::TransferSyntax& syntax, - const std::list& frames) + std::list& frames) { if (!dicom.GetDataSet().FindDataElement(OrthancPlugins::DICOM_TAG_PIXEL_DATA)) { @@ -931,6 +931,16 @@ } size_t framesCount = pixelData.GetByteValue()->GetLength() / frameSize; + + if (frames.empty()) + { + // If no frame is provided, return all the frames (this is an extension) + for (size_t i = 0; i < framesCount; i++) + { + frames.push_back(i); + } + } + const char* buffer = pixelData.GetByteValue()->GetPointer(); assert(sizeof(char) == 1); @@ -955,6 +965,15 @@ { // Multi-fragment image, we assume that each fragment corresponds to one frame + if (frames.empty()) + { + // If no frame is provided, return all the frames (this is an extension) + for (size_t i = 0; i < fragments->GetNumberOfFragments(); i++) + { + frames.push_back(i); + } + } + for (std::list::const_iterator frame = frames.begin(); frame != frames.end(); ++frame) {