| 171 | }; |
| 172 | |
| 173 | DicomPixelModule readPixelModule(const gdcm::DataSet& ds, const gdcm::Image& image) { |
| 174 | DicomPixelModule m; |
| 175 | |
| 176 | const auto& pf = image.GetPixelFormat(); |
| 177 | m.bitsAllocated = pf.GetBitsAllocated(); |
| 178 | m.bitsStored = pf.GetBitsStored(); |
| 179 | m.highBit = pf.GetHighBit(); |
| 180 | m.pixelRepresentation = pf.GetPixelRepresentation(); |
| 181 | m.samplesPerPixel = pf.GetSamplesPerPixel(); |
| 182 | m.planarConfiguration = (uint16_t)image.GetPlanarConfiguration(); |
| 183 | |
| 184 | // Window Center / Width (0028,1050)/(0028,1051). May be multi-valued; take the first preset if present. |
| 185 | m.windowCenter = dicomGetValue<0x0028, 0x1050, double>(ds); |
| 186 | m.windowWidth = dicomGetValue<0x0028, 0x1051, double>(ds); |
| 187 | |
| 188 | return m; |
| 189 | } |
| 190 | |
| 191 | // Stage 2: stored -> physical. Optional. Returns true if anything was applied. |
| 192 | Task<bool> applyModalityRescale(float slope, float intercept, const MultiChannelView<float>& view, int priority) { |