comparison Applications/StoneWebViewer/WebAssembly/StoneWebViewer.cpp @ 2146:743fa9c74443 dicom-sr tip

integration mainline->dicom-sr
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 16 Aug 2024 18:09:53 +0200
parents 9d77c935f2c3 5f0529b2ce65
children
comparison
equal deleted inserted replaced
2144:9d77c935f2c3 2146:743fa9c74443
2205 if (params.GetWindowingPresetsCount() == 0) 2205 if (params.GetWindowingPresetsCount() == 0)
2206 { 2206 {
2207 LOG(INFO) << "No preset windowing"; 2207 LOG(INFO) << "No preset windowing";
2208 } 2208 }
2209 2209
2210 uint32_t bitsStored, pixelRepresentation;
2211 if (dicom.ParseUnsignedInteger32(bitsStored, Orthanc::DICOM_TAG_BITS_STORED) &&
2212 dicom.ParseUnsignedInteger32(pixelRepresentation, Orthanc::DICOM_TAG_PIXEL_REPRESENTATION))
2213 {
2214 // Added in Stone Web viewer > 2.5
2215 const bool isSigned = (pixelRepresentation != 0);
2216 const float maximum = powf(2.0, bitsStored);
2217 GetViewport().windowingDefaultCenter_ = (isSigned ? 0.0f : maximum / 2.0f);
2218 GetViewport().windowingDefaultWidth_ = maximum;
2219 }
2220 else
2221 {
2222 GetViewport().windowingDefaultCenter_ = 128;
2223 GetViewport().windowingDefaultWidth_ = 256;
2224 }
2225
2210 GetViewport().SetWindowingPreset(); 2226 GetViewport().SetWindowingPreset();
2211 } 2227 }
2212 2228
2213 uint32_t cineRate; 2229 uint32_t cineRate;
2214 if (dicom.ParseUnsignedInteger32(cineRate, Orthanc::DICOM_TAG_CINE_RATE) && 2230 if (dicom.ParseUnsignedInteger32(cineRate, Orthanc::DICOM_TAG_CINE_RATE) &&
2498 std::unique_ptr<SeriesCursor> cursor_; 2514 std::unique_ptr<SeriesCursor> cursor_;
2499 float windowingCenter_; 2515 float windowingCenter_;
2500 float windowingWidth_; 2516 float windowingWidth_;
2501 std::vector<float> windowingPresetCenters_; 2517 std::vector<float> windowingPresetCenters_;
2502 std::vector<float> windowingPresetWidths_; 2518 std::vector<float> windowingPresetWidths_;
2519 float windowingDefaultCenter_;
2520 float windowingDefaultWidth_;
2503 unsigned int cineRate_; 2521 unsigned int cineRate_;
2504 bool inverted_; 2522 bool inverted_;
2505 bool fitNextContent_; 2523 bool fitNextContent_;
2506 std::list<PrefetchItem> prefetchQueue_; 2524 std::list<PrefetchItem> prefetchQueue_;
2507 bool serverSideTranscoding_; 2525 bool serverSideTranscoding_;
3047 bool softwareRendering, 3065 bool softwareRendering,
3048 bool linearInterpolation) : 3066 bool linearInterpolation) :
3049 context_(context), 3067 context_(context),
3050 source_(source), 3068 source_(source),
3051 framesCache_(cache), 3069 framesCache_(cache),
3070 windowingDefaultCenter_(128),
3071 windowingDefaultWidth_(256),
3052 fitNextContent_(true), 3072 fitNextContent_(true),
3053 hasFocusOnInstance_(false), 3073 hasFocusOnInstance_(false),
3054 focusFrameNumber_(0), 3074 focusFrameNumber_(0),
3055 synchronizationOffset_(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0)), 3075 synchronizationOffset_(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0)),
3056 synchronizationEnabled_(false), 3076 synchronizationEnabled_(false),
3599 { 3619 {
3600 assert(windowingPresetCenters_.size() == windowingPresetWidths_.size()); 3620 assert(windowingPresetCenters_.size() == windowingPresetWidths_.size());
3601 3621
3602 if (windowingPresetCenters_.empty()) 3622 if (windowingPresetCenters_.empty())
3603 { 3623 {
3604 SetWindowing(128, 256); 3624 SetWindowing(windowingDefaultCenter_, windowingDefaultWidth_);
3605 } 3625 }
3606 else 3626 else
3607 { 3627 {
3608 SetWindowing(windowingPresetCenters_[0], windowingPresetWidths_[0]); 3628 SetWindowing(windowingPresetCenters_[0], windowingPresetWidths_[0]);
3609 } 3629 }