MedicalViewerPaletteType Enumeration

Summary
Represents the enumeration that determines the palette used to display the image.
Syntax
C#
C++/CLI
public enum MedicalViewerPaletteType 
            public enum class MedicalViewerPaletteType : public System.Enum, System.IComparable, System.IConvertible, System.IFormattable   
Members
ValueMemberDescription
0None None, use the normal gray-scale lookup table.
1Cool Cool palette.
2CyanHot Cyan Hot palette.
3Fire Fire palette.
4ICA2 ICA2 palette.
5Ice Ice palette.
6OrangeHot Orange hot palette.
7RainbowRGB Rainbow RGB palette.
8RedHot Red hot palette.
9Spectrum Spectrum palette.
Remarks
  • This enumeration is used with the property MedicalViewerSubCell.PaletteType
  • To disable using the palette, set this enumeration to None.
  • The palette works by replacing the gray intensity values stored in the image lookup table with the values stored in the palette.
Example
C#
using Leadtools; 
using Leadtools.Dicom; 
using Leadtools.Medical3D; 
using Leadtools.Codecs; 
using Leadtools.MedicalViewer; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Annotations.Engine; 
using Leadtools.Annotations.Designers; 
 
class MedicalViewerPaletteForm : Form 
{ 
   private MedicalViewer _medicalViewer; 
   private MedicalViewerSeriesManager _seriesManager; 
 
   void MedicalViewerLocalizer_SizeChanged(object sender, EventArgs e) 
   { 
      _medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom); 
   } 
 
   public MedicalViewerPaletteForm(MedicalViewerSeriesManager output) 
   { 
      DicomEngine.Startup(); 
      RasterCodecs _codecs = new RasterCodecs(); 
 
      this.SizeChanged += new EventHandler(MedicalViewerLocalizer_SizeChanged); 
 
      // Create the medical viewer and adjust the size and the location. 
      _medicalViewer = new MedicalViewer(1, 2); 
      _medicalViewer.Location = new Point(0, 0); 
      _medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom); 
 
      _seriesManager = output; 
 
      MedicalViewerMultiCell cell = new MedicalViewerMultiCell(null, true, 1, 1); 
 
      int index; 
      int count = output.Stacks[0].Items.Count; 
      CodecsImageInfo codecsInformation; 
 
      MedicalViewerImageInformation[] imageInformation = new MedicalViewerImageInformation[count]; 
 
      for (index = 0; index < count; index++) 
      { 
         codecsInformation = _codecs.GetInformation((string)(output.Stacks[0].Items[index].Data), true); 
 
         imageInformation[index] = new MedicalViewerImageInformation(); 
         imageInformation[index].ImageHeight = codecsInformation.Width; 
         imageInformation[index].ImageWidth = codecsInformation.Width; 
         imageInformation[index].XResolution = codecsInformation.XResolution; 
         imageInformation[index].YResolution = codecsInformation.YResolution; 
      } 
 
      cell.FramesRequested += new EventHandler<MedicalViewerRequestedFramesInformationEventArgs>(cell_FramesRequested); 
      FormClosing += new FormClosingEventHandler(MedicalViewerLocalizer_FormClosing); 
      cell.EnableLowMemoryUsage(2, count, imageInformation); 
      cell.FitImageToCell = false; 
 
      // add some actions that will be used to change the properties of the images inside the control. 
      cell.AddAction(MedicalViewerActionType.WindowLevel); 
      cell.AddAction(MedicalViewerActionType.Alpha); 
      cell.AddAction(MedicalViewerActionType.Offset); 
      cell.MouseWheel += new MouseEventHandler(cell_MouseWheel); 
 
 
      // assign the added actions to a mouse button, meaning that when the user clicks and drags the mouse button, the associated action will be activated. 
      cell.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active); 
      cell.SetAction(MedicalViewerActionType.Alpha, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active); 
      cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active); 
 
      cell.ReferenceLine.Enabled = true; 
      cell.ReferenceLine.Color = Color.Yellow; 
      cell.ShowCellBoundaries = true; 
 
      _medicalViewer.Cells.Add(cell); 
      // adjust some properties of the cell and add some tags. 
      _medicalViewer.Cells[0].SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448"); 
      _medicalViewer.Cells[0].SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame); 
      _medicalViewer.Cells[0].SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale); 
      _medicalViewer.Cells[0].SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData); 
      _medicalViewer.Cells[0].SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView); 
 
      cell.PixelSpacing = output.Stacks[0].PixelSpacing; 
 
      for (index = 0; index < count; index++) 
      { 
         cell.SetImagePosition(index, output.Stacks[0].Items[index].ImagePosition, (index == count - 1)); 
      } 
      cell.ImageOrientation = output.Stacks[0].Items[0].ImageOrientationArray; 
      cell.FrameOfReferenceUID = output.Stacks[0].Items[0].FrameOfReferenceUID; 
 
 
      cell.ActiveSubCell = cell.PageCount / 2; 
      Controls.Add(_medicalViewer); 
      _medicalViewer.Dock = DockStyle.Fill; 
      DicomEngine.Shutdown(); 
   } 
 
   void cell_MouseWheel(object sender, MouseEventArgs e) 
   { 
      MedicalViewerMultiCell cell = ((MedicalViewerMultiCell)sender); 
      int paletteType = (int)cell.SubCells[cell.ActiveSubCell].PaletteType; 
 
      paletteType++; 
 
      if (paletteType > 9) 
         paletteType = 0; 
 
      cell.SubCells[cell.ActiveSubCell].PaletteType = (MedicalViewerPaletteType)paletteType; 
   } 
 
   void MedicalViewerLocalizer_FormClosing(object sender, FormClosingEventArgs e) 
   { 
   } 
 
   void cell_FramesRequested(object sender, MedicalViewerRequestedFramesInformationEventArgs e) 
   { 
      MedicalViewerMultiCell cell = (MedicalViewerMultiCell)(sender); 
      RasterCodecs _codecs = new RasterCodecs(); 
      int i; 
      RasterImage image; 
      string fileName; 
 
      if (e.RequestedFramesIndexes.Length > 0) 
      { 
         fileName = (string)(_seriesManager.Stacks[0].Items[e.RequestedFramesIndexes[0]].Data); 
         image = _codecs.Load(fileName); 
      } 
      else 
         return; 
 
      for (i = 1; i < e.RequestedFramesIndexes.Length; i++) 
      { 
         fileName = (string)(_seriesManager.Stacks[0].Items[e.RequestedFramesIndexes[i]].Data); 
         image.AddPage(_codecs.Load(fileName)); 
      } 
 
      cell.SetRequestedImage(image, e.RequestedFramesIndexes, MedicalViewerSetImageOptions.Insert); 
   } 
 
   public MedicalViewer Viewer 
   { 
      get { return _medicalViewer; } 
   } 
} 
 
MedicalViewerPaletteForm GetMedicalViewerPaletteForm() 
{ 
   MessageBox.Show("scroll the mouse wheel to switch between built-in palettes, left click to update the window level parameters"); 
   MedicalViewerSeriesManagerFrom form = new MedicalViewerSeriesManagerFrom(); 
   MedicalViewerSeriesManager output = form.LoadJamesHead(); 
 
   return new MedicalViewerPaletteForm(output); 
} 
 
// This example changes the default window level value by decrease the width by 100. Then resets the images based on the new value. 
public void MedicalViewerPaletteExample() 
{ 
   MedicalViewerPaletteForm myForm = GetMedicalViewerPaletteForm(); 
   MedicalViewer medicalViewer = myForm.Viewer; 
 
   myForm.ShowDialog(); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.MedicalViewer Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.