Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkColorSequenceRainbow.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
17 #include <vector>
18 namespace mitk
19 {
21  {
22  m_ColorIndex = 0;
23  m_Color.SetRed(1.0);
24  m_Color.SetGreen(0.67);
25  m_Color.SetBlue(0.0);
26  InitColorList();
27  } // end of constructor
28 
31  {
32  if (m_ColorIndex < (m_ColorList.size() - 1))
33  {
34  m_ColorIndex++;
35  }
36  else
37  {
38  m_ColorIndex = 0;
39  }
40  m_Color = m_ColorList[m_ColorIndex];
41  return m_Color;
42  } // end of GetNextMitkColor()
43 
44  void ColorSequenceRainbow::InitColorList()
45  {
46  mitk::Color defaultColor, red, green, blue, yellow, magenta, cyan, orange;
47  defaultColor.Set(1.0, 0.67, 0.0);
48  red.Set(1.0, 0.0, 0.0);
49  green.Set(0.0, 1.0, 0.0);
50  blue.Set(0.0, 0.0, 1.0);
51  yellow.Set(1.0, 1.0, 0.0);
52  magenta.Set(1.0, 0.0, 1.0);
53  cyan.Set(0.0, 1.0, 1.0);
54  orange.Set(1.0, 0.6, 0.0);
55  m_ColorList.push_back(defaultColor);
56  m_ColorList.push_back(red);
57  m_ColorList.push_back(yellow);
58  m_ColorList.push_back(blue);
59  m_ColorList.push_back(green);
60  m_ColorList.push_back(magenta);
61  m_ColorList.push_back(cyan);
62  m_ColorList.push_back(orange);
63  } // end of ColorList
64 
65  void ColorSequenceRainbow::GoToBegin() { m_ColorIndex = 0; }
66 } // end of namespace
virtual Color GetNextColor() override
method to return another color
DataCollection - Class to facilitate loading/accessing structured data.
virtual void GoToBegin() override
method to set the color-index to begin again
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)