Mercurial > hg > orthanc-stone
comparison Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 1970:33d2ff1aeaae
start ultrasound series at their first frame
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 28 Oct 2022 13:36:40 +0200 |
parents | 79fdc3b1f031 |
children | 5a434f5889f8 |
comparison
equal
deleted
inserted
replaced
1969:ee68ee732aa7 | 1970:33d2ff1aeaae |
---|---|
1196 return ((framesCount_ == 0 && frame == 0) || | 1196 return ((framesCount_ == 0 && frame == 0) || |
1197 (framesCount_ > 0 && frame >= 0 && frame < framesCount_)); | 1197 (framesCount_ > 0 && frame >= 0 && frame < framesCount_)); |
1198 } | 1198 } |
1199 | 1199 |
1200 public: | 1200 public: |
1201 explicit SeriesCursor(size_t framesCount) : | 1201 explicit SeriesCursor(size_t framesCount, |
1202 bool startAtMiddle /* Whether to start at the middle frame */) : | |
1202 framesCount_(framesCount), | 1203 framesCount_(framesCount), |
1203 currentFrame_(framesCount / 2), // Start at the middle frame | 1204 currentFrame_(startAtMiddle ? framesCount / 2 : 0), |
1204 isCircularPrefetch_(false), | 1205 isCircularPrefetch_(false), |
1205 lastAction_(Action_None) | 1206 lastAction_(Action_None) |
1206 { | 1207 { |
1207 SetFastDelta(framesCount / 20); | 1208 SetFastDelta(framesCount / 20); |
1208 UpdatePrefetch(); | 1209 UpdatePrefetch(); |
2761 inverted_ = false; | 2762 inverted_ = false; |
2762 serverSideTranscoding_ = false; | 2763 serverSideTranscoding_ = false; |
2763 OrthancStone::LinearAlgebra::AssignVector(synchronizationOffset_, 0, 0, 0); | 2764 OrthancStone::LinearAlgebra::AssignVector(synchronizationOffset_, 0, 0, 0); |
2764 | 2765 |
2765 frames_.reset(frames); | 2766 frames_.reset(frames); |
2766 cursor_.reset(new SeriesCursor(frames_->GetFramesCount())); | 2767 cursor_.reset(new SeriesCursor(frames_->GetFramesCount(), false)); |
2768 | |
2769 if (frames_->GetFramesCount() != 0) | |
2770 { | |
2771 const OrthancStone::DicomInstanceParameters& firstInstance = frames_->GetInstanceOfFrame(0); | |
2772 std::string modality; | |
2773 if (firstInstance.GetTags().LookupStringValue(modality, Orthanc::DICOM_TAG_MODALITY, false)) | |
2774 { | |
2775 if (modality == "MR" || | |
2776 modality == "CT" || | |
2777 modality == "NM" || | |
2778 modality == "OPT" || | |
2779 modality == "PT" || | |
2780 modality == "RTDOSE" || | |
2781 modality == "XA") | |
2782 { | |
2783 // For series that might correspond to 3D images, use their | |
2784 // central frame as the first frame to be displayed | |
2785 cursor_.reset(new SeriesCursor(frames_->GetFramesCount(), true)); | |
2786 } | |
2787 } | |
2788 } | |
2767 | 2789 |
2768 LOG(INFO) << "Number of frames in series: " << frames_->GetFramesCount(); | 2790 LOG(INFO) << "Number of frames in series: " << frames_->GetFramesCount(); |
2769 | 2791 |
2770 SetWindowingPreset(); | 2792 SetWindowingPreset(); |
2771 ClearViewport(); | 2793 ClearViewport(); |