* Default constructor. Protected to prevent "normal" creation */
| 18 | * Default constructor. Protected to prevent "normal" creation |
| 19 | */ |
| 20 | mitk::LabeledImageLookupTable::LabeledImageLookupTable() : m_LevelWindow(128, 256) |
| 21 | { |
| 22 | if (m_LookupTable == nullptr) |
| 23 | { |
| 24 | itkWarningMacro( |
| 25 | "LookupTable is nullptr, it should have been initialized by the default constructor of mitk::LookupTable"); |
| 26 | m_LookupTable = vtkLookupTable::New(); |
| 27 | } |
| 28 | m_LookupTable->SetNumberOfTableValues(256); |
| 29 | |
| 30 | // set the background to black and fully transparent |
| 31 | m_LookupTable->SetTableValue(0, 0.0, 0.0, 0.0, 0.0); |
| 32 | |
| 33 | // initialize the remaining 255 colors with random values and |
| 34 | // an alpha value of 1.0 |
| 35 | double r, g, b; |
| 36 | |
| 37 | // |
| 38 | // Initialize the random number generator with an arbitrary seed. |
| 39 | // This way, the generated colors are random, but always the same... |
| 40 | std::srand(2); |
| 41 | for (vtkIdType index = 1; index < 256; ++index) |
| 42 | { |
| 43 | GenerateRandomColor(r, g, b); |
| 44 | m_LookupTable->SetTableValue(index, r, g, b); |
| 45 | } |
| 46 | |
| 47 | // initialize the default level/window settings, |
| 48 | // which can be accessed via GetLevelWindow(); |
| 49 | m_LevelWindow.SetRangeMinMax(0, 255); |
| 50 | m_LevelWindow.SetWindowBounds(0, 255); |
| 51 | m_LevelWindow.SetFixed(true); |
| 52 | } |
| 53 | |
| 54 | mitk::LabeledImageLookupTable::LabeledImageLookupTable(const mitk::LabeledImageLookupTable &other) |
| 55 | : LookupTable(other), m_LevelWindow(other.m_LevelWindow) |
nothing calls this directly
no test coverage detected