Medical Imaging Interaction Toolkit  2018.4.99-b20efe7f
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
13 #include <vector>
14 namespace mitk
15 {
17  {
18  m_ColorIndex = 0;
19  m_Color.SetRed(1.0);
20  m_Color.SetGreen(0.67);
21  m_Color.SetBlue(0.0);
22  InitColorList();
23  } // end of constructor
24 
27  {
28  if (m_ColorIndex < (m_ColorList.size() - 1))
29  {
30  m_ColorIndex++;
31  }
32  else
33  {
34  m_ColorIndex = 0;
35  }
36  m_Color = m_ColorList[m_ColorIndex];
37  return m_Color;
38  } // end of GetNextMitkColor()
39 
40  void ColorSequenceRainbow::InitColorList()
41  {
42  mitk::Color defaultColor, red, green, blue, yellow, magenta, cyan, orange;
43  defaultColor.Set(1.0, 0.67, 0.0);
44  red.Set(1.0, 0.0, 0.0);
45  green.Set(0.0, 1.0, 0.0);
46  blue.Set(0.0, 0.0, 1.0);
47  yellow.Set(1.0, 1.0, 0.0);
48  magenta.Set(1.0, 0.0, 1.0);
49  cyan.Set(0.0, 1.0, 1.0);
50  orange.Set(1.0, 0.6, 0.0);
51  m_ColorList.push_back(defaultColor);
52  m_ColorList.push_back(red);
53  m_ColorList.push_back(yellow);
54  m_ColorList.push_back(blue);
55  m_ColorList.push_back(green);
56  m_ColorList.push_back(magenta);
57  m_ColorList.push_back(cyan);
58  m_ColorList.push_back(orange);
59  } // end of ColorList
60 
61  void ColorSequenceRainbow::GoToBegin() { m_ColorIndex = 0; }
62 } // end of namespace
Color GetNextColor() override
method to return another color
DataCollection - Class to facilitate loading/accessing structured data.
void GoToBegin() override
method to set the color-index to begin again
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)