Example #1
0
        private void SetWindow(double windowWidth, double windowCenter, out IBasicVoiLutLinear voiLut)
        {
            voiLut = null;
            if (!CanWindowLevel())
            {
                return;
            }

            IVoiLutManager manager     = SelectedVoiLutProvider.VoiLutManager;
            var            linearLut   = manager.VoiLut as IVoiLutLinear;
            var            standardLut = linearLut as IBasicVoiLutLinear;

            if (standardLut == null)
            {
                standardLut = new BasicVoiLutLinear(windowWidth, windowCenter);
                manager.InstallVoiLut(standardLut);
            }
            else
            {
                standardLut.WindowWidth  = windowWidth;
                standardLut.WindowCenter = windowCenter;
            }

            voiLut = standardLut;
            SelectedVoiLutProvider.Draw();
        }
Example #2
0
        private void IncrementWindow(double windowIncrement, double levelIncrement)
        {
            if (!CanWindowLevel())
            {
                return;
            }

            IVoiLutManager manager = SelectedVoiLutProvider.VoiLutManager;

            IVoiLutLinear      linearLut   = manager.VoiLut as IVoiLutLinear;
            IBasicVoiLutLinear standardLut = linearLut as IBasicVoiLutLinear;

            if (standardLut == null)
            {
                BasicVoiLutLinear installLut = new BasicVoiLutLinear(linearLut.WindowWidth, linearLut.WindowCenter);
                manager.InstallVoiLut(installLut);
            }

            standardLut               = manager.VoiLut as IBasicVoiLutLinear;
            standardLut.WindowWidth  += windowIncrement;
            standardLut.WindowCenter += levelIncrement;
            SelectedVoiLutProvider.Draw();
        }