Example #1
0
        private void AutoApplyWW_WC(MedicalViewerCell cell, int _WW, int _WC)
        {

            try
            {
                if (cell.Image.Order == RasterByteOrder.Gray && cell.Image.BitsPerPixel > 8)
                {
                    // update lookup table

                    try
                    {

                        ApplyLinearVoiLookupTableCommand command = new ApplyLinearVoiLookupTableCommand();
                        MinMaxBitsCommand minMaxBits = new MinMaxBitsCommand();
                        MinMaxValuesCommand minMaxValues = new MinMaxValuesCommand();
                        //if (ADJUST_WOB)
                        //command.Flags = VoiLookupTableCommandFlags.ReverseOrder;
                        // else
                        command.Flags = VoiLookupTableCommandFlags.None;

                        minMaxBits.Run(cell.Image);
                        cell.Image.LowBit = minMaxBits.MinimumBit;
                        cell.Image.HighBit = minMaxBits.MaximumBit;
                        minMaxValues.Run(cell.Image);
                        command.Width = _WW;
                        command.Center = _WC;
                        command.Run(cell.Image);
                        cell.Invalidate();
                        WindowLevelCommand _WindowLevelCommand = new WindowLevelCommand();
                        _WindowLevelCommand.HighBit = cell.Image.HighBit;
                        _WindowLevelCommand.LowBit = cell.Image.LowBit;
                        _WindowLevelCommand.LookupTable = cell.Image.GetLookupTable();
                        //_WindowLevelCommand.Order = RasterByteOrder.Rgb;
                        _WindowLevelCommand.Run(cell.Image);
                    }
                    catch
                    {
                    }
                }
            }
            catch
            {
            }
            finally
            {

            }
        }