Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPlugins.cpp @ 1802:138664eb59de worklists
sample worklist plugin
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 20 Nov 2015 15:54:07 +0100 |
parents | 2c60c357ee3e |
children | 5ed8769b17f9 |
comparison
equal
deleted
inserted
replaced
1801:2c60c357ee3e | 1802:138664eb59de |
---|---|
361 } | 361 } |
362 | 362 |
363 Reset(); | 363 Reset(); |
364 } | 364 } |
365 | 365 |
366 bool IsMatch(const void* dicom, | |
367 size_t size) const | |
368 { | |
369 assert(matcher_.get() != NULL); | |
370 ParsedDicomFile f(dicom, size); | |
371 return matcher_->Match(f); | |
372 } | |
373 | |
374 void GetQueryDicom(OrthancPluginMemoryBuffer& target) const | 366 void GetQueryDicom(OrthancPluginMemoryBuffer& target) const |
375 { | 367 { |
376 assert(currentQuery_ != NULL); | 368 assert(currentQuery_ != NULL); |
377 std::string dicom; | 369 std::string dicom; |
378 currentQuery_->SaveToMemoryBuffer(dicom); | 370 currentQuery_->SaveToMemoryBuffer(dicom); |
379 CopyToMemoryBuffer(target, dicom.c_str(), dicom.size()); | 371 CopyToMemoryBuffer(target, dicom.c_str(), dicom.size()); |
372 } | |
373 | |
374 bool IsMatch(const void* dicom, | |
375 size_t size) const | |
376 { | |
377 assert(matcher_.get() != NULL); | |
378 ParsedDicomFile f(dicom, size); | |
379 return matcher_->Match(f); | |
380 } | |
381 | |
382 void AddAnswer(OrthancPluginWorklistAnswers* answers, | |
383 const void* dicom, | |
384 size_t size) const | |
385 { | |
386 assert(matcher_.get() != NULL); | |
387 ParsedDicomFile f(dicom, size); | |
388 std::auto_ptr<ParsedDicomFile> summary(matcher_->Extract(f)); | |
389 reinterpret_cast<DicomFindAnswers*>(answers)->Add(*summary); | |
380 } | 390 } |
381 }; | 391 }; |
382 | 392 |
383 | 393 |
384 static char* CopyString(const std::string& str) | 394 static char* CopyString(const std::string& str) |
1924 | 1934 |
1925 case _OrthancPluginService_AddWorklistAnswer: | 1935 case _OrthancPluginService_AddWorklistAnswer: |
1926 { | 1936 { |
1927 const _OrthancPluginWorklistAnswersOperation& p = | 1937 const _OrthancPluginWorklistAnswersOperation& p = |
1928 *reinterpret_cast<const _OrthancPluginWorklistAnswersOperation*>(parameters); | 1938 *reinterpret_cast<const _OrthancPluginWorklistAnswersOperation*>(parameters); |
1929 | 1939 reinterpret_cast<const WorklistHandler*>(p.query)->AddAnswer(p.answers, p.dicom, p.size); |
1930 ParsedDicomFile answer(p.dicom, p.size); | |
1931 reinterpret_cast<DicomFindAnswers*>(p.answers)->Add(answer); | |
1932 return true; | 1940 return true; |
1933 } | 1941 } |
1934 | 1942 |
1935 case _OrthancPluginService_MarkWorklistAnswersIncomplete: | 1943 case _OrthancPluginService_MarkWorklistAnswersIncomplete: |
1936 { | 1944 { |
1937 const _OrthancPluginWorklistAnswersOperation& p = | 1945 const _OrthancPluginWorklistAnswersOperation& p = |
1938 *reinterpret_cast<const _OrthancPluginWorklistAnswersOperation*>(parameters); | 1946 *reinterpret_cast<const _OrthancPluginWorklistAnswersOperation*>(parameters); |
1939 | |
1940 reinterpret_cast<DicomFindAnswers*>(p.answers)->SetComplete(false); | 1947 reinterpret_cast<DicomFindAnswers*>(p.answers)->SetComplete(false); |
1941 return true; | 1948 return true; |
1942 } | 1949 } |
1943 | 1950 |
1944 case _OrthancPluginService_IsWorklistMatch: | 1951 case _OrthancPluginService_IsWorklistMatch: |