Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I looked at the code and it looked extremely buggy. <a href="https://github.com/rcd/fo-dicom/blob/master/DICOM/Imaging/DicomImage.cs" rel="nofollow">https://github.com/rcd/fo-dicom/blob/master/DICOM/Imaging/DicomImage.cs</a></p> <p>In the current buggy implementation setting the <code>WindowCenter</code> or <code>WindowWidth</code> properties has no effect unless Dataset.Get(DicomTag.PhotometricInterpretation) is either <code>Monochrome1</code> or <code>Monochrome2</code> during <code>Load()</code>. This is already ridiculous, but it still cannot be used because the <code>_renderOptions</code> variable is only set in a single place and is immediately used for the <code>_pipeline</code> creation (not giving you chance to change it using the <code>WindowCenter</code> property). Your only chance is the grayscale <code>_renderOptions</code> initialization: <code>_renderOptions = GrayscaleRenderOptions.FromDataset(Dataset);</code>.</p> <p>The current solution: Your dataset should have</p> <ul> <li><code>DicomTag.WindowCenter</code> set appropriately</li> <li><code>DicomTag.WindowWidth != 0.0</code></li> <li><code>DicomTag.PhotometricInterpretation == Monochrome1</code> or <code>Monochrome2</code></li> </ul> <p>The following code accomplishes that:</p> <pre><code>DicomDataset dataset = DicomFile.Open(fileName).Dataset; //dataset.Set(DicomTag.WindowWidth, 200.0); //the WindowWidth must be non-zero dataset.Add(DicomTag.WindowCenter, "100.0"); //dataset.Add(DicomTag.PhotometricInterpretation, "MONOCHROME1"); //ValueRepresentations tag is broken dataset.Add(new DicomCodeString(DicomTag.PhotometricInterpretation, "MONOCHROME1")); DicomImage image = new DicomImage(dataset); image.RenderImage(); </code></pre> <p>The best solution: Wait while this buggy library is fixed.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload