Skip to content

Commit

Permalink
Fix failing unit test. Centralize what a valid preset is. Update docs
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Apr 22, 2024
1 parent 3dc8d53 commit c954a26
Show file tree
Hide file tree
Showing 123 changed files with 181 additions and 40 deletions.
5 changes: 5 additions & 0 deletions resources/ColorTablePresets/ColorTablePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2937,6 +2937,11 @@
0.0
]
},
{
"ColorSpace" : "RGB",
"Name" : "Rainbow",
"RGBPoints" : [ -1, 0, 0, 1, -0.5, 0, 1, 1, 0, 0, 1, 0, 0.5, 1, 1, 0, 1, 1, 0, 0 ]
},
{
"ColorSpace": "RGB",
"Name": "Rainbow Desaturated",
Expand Down
135 changes: 120 additions & 15 deletions src/Plugins/SimplnxCore/docs/GenerateColorTableFilter.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,126 @@ value.

These are the valid preset strings that can be used.

* "Rainbow Desaturated"
* "Cold and Hot"
* "Black-Body Radiation"
* "X Ray"
* "Grayscale"
* "Black, Blue and White"
* "Black, Orange and White"
* "Rainbow Blended White"
* "Rainbow Blended Grey"
* "Rainbow Blended Black"
* "Blue to Yellow"
* "jet"
* "rainbow"
* "Haze"
* "hsv"
| Preset Name | Color Space | Example |
|-------------|-------------|---------|
| 2hot | Lab | ![2hot](Images/ColorTable_2hot.png) |
| Asymmetrical Earth Tones (6_21b) | Lab | ![Asymmetrical Earth Tones (6_21b)](Images/ColorTable_Asymmetrical_Earth_Tones_(6_21b).png) |
| Black-Body Radiation | RGB | ![Black-Body Radiation](Images/ColorTable_Black-Body_Radiation.png) |
| Black, Blue and White | RGB | ![Black, Blue and White](Images/ColorTable_Black_Blue_and_White.png) |
| Black, Orange and White | RGB | ![Black, Orange and White](Images/ColorTable_Black_Orange_and_White.png) |
| Blue - Green - Orange | CIELAB | ![Blue - Green - Orange](Images/ColorTable_Blue_Green_Orange.png) |
| Blue Orange (divergent) | Lab | ![Blue Orange (divergent)](Images/ColorTable_Blue_Orange_(divergent).png) |
| Blue to Yellow | RGB | ![Blue to Yellow](Images/ColorTable_Blue_to_Yellow.png) |
| BLUE-WHITE | Lab | ![BLUE-WHITE](Images/ColorTable_BLUE-WHITE.png) |
| blue2cyan | Lab | ![blue2cyan](Images/ColorTable_blue2cyan.png) |
| blue2yellow | Lab | ![blue2yellow](Images/ColorTable_blue2yellow.png) |
| Blues | Lab | ![Blues](Images/ColorTable_Blues.png) |
| bone_Matlab | Lab | ![bone_Matlab](Images/ColorTable_bone_Matlab.png) |
| BrBG | Lab | ![BrBG](Images/ColorTable_BrBG.png) |
| BrOrYl | Lab | ![BrOrYl](Images/ColorTable_BrOrYl.png) |
| BuGn | Lab | ![BuGn](Images/ColorTable_BuGn.png) |
| BuGnYl | Lab | ![BuGnYl](Images/ColorTable_BuGnYl.png) |
| BuPu | Lab | ![BuPu](Images/ColorTable_BuPu.png) |
| BuRd | Lab | ![BuRd](Images/ColorTable_BuRd.png) |
| CIELab Blue to Red | Lab | ![CIELab Blue to Red](Images/ColorTable_CIELab_Blue_to_Red.png) |
| Cividis | Lab | ![Cividis](Images/ColorTable_Cividis.png) |
| Cold and Hot | RGB | ![Cold and Hot](Images/ColorTable_Cold_and_Hot.png) |
| Cool to Warm (Extended) | Lab | ![Cool to Warm (Extended)](Images/ColorTable_Cool_to_Warm_(Extended).png) |
| Cool to Warm | Diverging | ![Cool to Warm](Images/ColorTable_Cool_to_Warm.png) |
| copper_Matlab | Lab | ![copper_Matlab](Images/ColorTable_copper_Matlab.png) |
| erdc_blue_BW | Lab | ![erdc_blue_BW](Images/ColorTable_erdc_blue_BW.png) |
| erdc_blue2cyan_BW | Lab | ![erdc_blue2cyan_BW](Images/ColorTable_erdc_blue2cyan_BW.png) |
| erdc_blue2gold | Lab | ![erdc_blue2gold](Images/ColorTable_erdc_blue2gold.png) |
| erdc_blue2gold_BW | Lab | ![erdc_blue2gold_BW](Images/ColorTable_erdc_blue2gold_BW.png) |
| erdc_blue2green_BW | Lab | ![erdc_blue2green_BW](Images/ColorTable_erdc_blue2green_BW.png) |
| erdc_blue2green_muted | Lab | ![erdc_blue2green_muted](Images/ColorTable_erdc_blue2green_muted.png) |
| erdc_blue2yellow | Lab | ![erdc_blue2yellow](Images/ColorTable_erdc_blue2yellow.png) |
| erdc_brown_BW | Lab | ![erdc_brown_BW](Images/ColorTable_erdc_brown_BW.png) |
| erdc_cyan2orange | Lab | ![erdc_cyan2orange](Images/ColorTable_erdc_cyan2orange.png) |
| erdc_divHi_purpleGreen | Lab | ![erdc_divHi_purpleGreen](Images/ColorTable_erdc_divHi_purpleGreen.png) |
| erdc_divHi_purpleGreen_dim | Lab | ![erdc_divHi_purpleGreen_dim](Images/ColorTable_erdc_divHi_purpleGreen_dim.png) |
| erdc_divLow_icePeach | Lab | ![erdc_divLow_icePeach](Images/ColorTable_erdc_divLow_icePeach.png) |
| erdc_divLow_purpleGreen | Lab | ![erdc_divLow_purpleGreen](Images/ColorTable_erdc_divLow_purpleGreen.png) |
| erdc_gold_BW | Lab | ![erdc_gold_BW](Images/ColorTable_erdc_gold_BW.png) |
| erdc_green2yellow_BW | Lab | ![erdc_green2yellow_BW](Images/ColorTable_erdc_green2yellow_BW.png) |
| erdc_iceFire_H | Lab | ![erdc_iceFire_H](Images/ColorTable_erdc_iceFire_H.png) |
| erdc_iceFire_L | Lab | ![erdc_iceFire_L](Images/ColorTable_erdc_iceFire_L.png) |
| erdc_magenta_BW | Lab | ![erdc_magenta_BW](Images/ColorTable_erdc_magenta_BW.png) |
| erdc_marine2gold_BW | Lab | ![erdc_marine2gold_BW](Images/ColorTable_erdc_marine2gold_BW.png) |
| erdc_orange_BW | Lab | ![erdc_orange_BW](Images/ColorTable_erdc_orange_BW.png) |
| erdc_pbj_lin | Lab | ![erdc_pbj_lin](Images/ColorTable_erdc_pbj_lin.png) |
| erdc_purple_BW | Lab | ![erdc_purple_BW](Images/ColorTable_erdc_purple_BW.png) |
| erdc_purple2green | Lab | ![erdc_purple2green](Images/ColorTable_erdc_purple2green.png) |
| erdc_purple2green_dark | Lab | ![erdc_purple2green_dark](Images/ColorTable_erdc_purple2green_dark.png) |
| erdc_purple2pink_BW | Lab | ![erdc_purple2pink_BW](Images/ColorTable_erdc_purple2pink_BW.png) |
| erdc_rainbow_bright | Lab | ![erdc_rainbow_bright](Images/ColorTable_erdc_rainbow_bright.png) |
| erdc_rainbow_dark | Lab | ![erdc_rainbow_dark](Images/ColorTable_erdc_rainbow_dark.png) |
| erdc_red_BW | Lab | ![erdc_red_BW](Images/ColorTable_erdc_red_BW.png) |
| erdc_red2purple_BW | Lab | ![erdc_red2purple_BW](Images/ColorTable_erdc_red2purple_BW.png) |
| erdc_red2yellow_BW | Lab | ![erdc_red2yellow_BW](Images/ColorTable_erdc_red2yellow_BW.png) |
| erdc_sapphire2gold_BW | Lab | ![erdc_sapphire2gold_BW](Images/ColorTable_erdc_sapphire2gold_BW.png) |
| Fast | RGB | ![Fast](Images/ColorTable_Fast.png) |
| GBBr | Lab | ![GBBr](Images/ColorTable_GBBr.png) |
| gist_earth | Lab | ![gist_earth](Images/ColorTable_gist_earth.png) |
| GnBu | Lab | ![GnBu](Images/ColorTable_GnBu.png) |
| GnBuPu | Lab | ![GnBuPu](Images/ColorTable_GnBuPu.png) |
| GnRP | Lab | ![GnRP](Images/ColorTable_GnRP.png) |
| GnYlRd | Lab | ![GnYlRd](Images/ColorTable_GnYlRd.png) |
| Gray and Red | Lab | ![Gray and Red](Images/ColorTable_Gray_and_Red.png) |
| Grayscale | RGB | ![Grayscale](Images/ColorTable_Grayscale.png) |
| Green-Blue Asymmetric Divergent (62Blbc) | Lab | ![Green-Blue Asymmetric Divergent (62Blbc)](Images/ColorTable_Green-Blue_Asymmetric_Divergent_(62Blbc).png) |
| GREEN-WHITE_LINEAR | Lab | ![GREEN-WHITE_LINEAR](Images/ColorTable_GREEN-WHITE_LINEAR.png) |
| Greens | Lab | ![Greens](Images/ColorTable_Greens.png) |
| GYPi | Lab | ![GYPi](Images/ColorTable_GYPi.png) |
| GyRd | Lab | ![GyRd](Images/ColorTable_GyRd.png) |
| Haze | RGB | ![Haze](Images/ColorTable_Haze.png) |
| Haze_cyan | Lab | ![Haze_cyan](Images/ColorTable_Haze_cyan.png) |
| Haze_green | Lab | ![Haze_green](Images/ColorTable_Haze_green.png) |
| Haze_lime | Lab | ![Haze_lime](Images/ColorTable_Haze_lime.png) |
| heated_object | Lab | ![heated_object](Images/ColorTable_heated_object.png) |
| hsv | RGB | ![hsv](Images/ColorTable_hsv.png) |
| hue_L60 | Lab | ![hue_L60](Images/ColorTable_hue_L60.png) |
| Inferno (matplotlib) | Diverging | ![Inferno (matplotlib)](Images/ColorTable_Inferno_(matplotlib).png) |
| Jet | RGB | ![Jet](Images/ColorTable_Jet.png) |
| Linear Blue (8_31f) | Lab | ![Linear Blue (8_31f)](Images/ColorTable_Linear_Blue_(8_31f).png) |
| Linear Green (Gr4L) | Lab | ![Linear Green (Gr4L)](Images/ColorTable_Linear_Green_(Gr4L).png) |
| Linear YGB 1211g | Lab | ![Linear YGB 1211g](Images/ColorTable_Linear_YGB_1211g.png) |
| magenta | Lab | ![magenta](Images/ColorTable_magenta.png) |
| Magma (matplotlib) | Diverging | ![Magma (matplotlib)](Images/ColorTable_Magma_(matplotlib).png) |
| Muted Blue-Green | Lab | ![Muted Blue-Green](Images/ColorTable_Muted_Blue-Green.png) |
| nic_CubicL | Lab | ![nic_CubicL](Images/ColorTable_nic_CubicL.png) |
| nic_CubicYF | Lab | ![nic_CubicYF](Images/ColorTable_nic_CubicYF.png) |
| nic_Edge | Lab | ![nic_Edge](Images/ColorTable_nic_Edge.png) |
| Oranges | Lab | ![Oranges](Images/ColorTable_Oranges.png) |
| OrPu | Lab | ![OrPu](Images/ColorTable_OrPu.png) |
| pink_Matlab | Lab | ![pink_Matlab](Images/ColorTable_pink_Matlab.png) |
| PiYG | Lab | ![PiYG](Images/ColorTable_PiYG.png) |
| Plasma (matplotlib) | Diverging | ![Plasma (matplotlib)](Images/ColorTable_Plasma_(matplotlib).png) |
| PRGn | Lab | ![PRGn](Images/ColorTable_PRGn.png) |
| PuBu | Lab | ![PuBu](Images/ColorTable_PuBu.png) |
| PuOr | Lab | ![PuOr](Images/ColorTable_PuOr.png) |
| PuRd | Lab | ![PuRd](Images/ColorTable_PuRd.png) |
| Purples | Lab | ![Purples](Images/ColorTable_Purples.png) |
| Rainbow | RGB | ![Rainbow](Images/ColorTable_Rainbow.png) |
| Rainbow Blended Black | RGB | ![Rainbow Blended Black](Images/ColorTable_Rainbow_Blended_Black.png) |
| Rainbow Blended Grey | RGB | ![Rainbow Blended Grey](Images/ColorTable_Rainbow_Blended_Grey.png) |
| Rainbow Blended White | RGB | ![Rainbow Blended White](Images/ColorTable_Rainbow_Blended_White.png) |
| Rainbow Desaturated | RGB | ![Rainbow Desaturated](Images/ColorTable_Rainbow_Desaturated.png) |
| Rainbow Uniform | RGB | ![Rainbow Uniform](Images/ColorTable_Rainbow_Uniform.png) |
| RdOr | Lab | ![RdOr](Images/ColorTable_RdOr.png) |
| RdOrYl | Lab | ![RdOrYl](Images/ColorTable_RdOrYl.png) |
| RdPu | Lab | ![RdPu](Images/ColorTable_RdPu.png) |
| RED_TEMPERATURE | Lab | ![RED_TEMPERATURE](Images/ColorTable_RED_TEMPERATURE.png) |
| RED-PURPLE | Lab | ![RED-PURPLE](Images/ColorTable_RED-PURPLE.png) |
| Reds | Lab | ![Reds](Images/ColorTable_Reds.png) |
| Spectral_lowBlue | Lab | ![Spectral_lowBlue](Images/ColorTable_Spectral_lowBlue.png) |
| Turbo | RGB | ![Turbo](Images/ColorTable_Turbo.png) |
| Viridis (matplotlib) | Diverging | ![Viridis (matplotlib)](Images/ColorTable_Viridis_(matplotlib).png) |
| Warm to Cool (Extended) | Lab | ![Warm to Cool (Extended)](Images/ColorTable_Warm_to_Cool_(Extended).png) |
| Warm to Cool | Diverging | ![Warm to Cool](Images/ColorTable_Warm_to_Cool.png) |
| X Ray | RGB | ![X Ray](Images/ColorTable_X_Ray.png) |
| Yellow - Gray - Blue | Lab | ![Yellow - Gray - Blue](Images/ColorTable_Yellow_Gray_Blue.png) |
| Yellow 15 | Lab | ![Yellow 15](Images/ColorTable_Yellow_15.png) |

% Auto generated parameter table will be inserted here

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 26 additions & 24 deletions src/Plugins/SimplnxCore/test/GenerateColorTableTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ const std::string k_ColdAndHotPresetName = "Cold and Hot";
const std::string k_GrayscalePresetName = "Grayscale";
const std::string k_HazePresetName = "Haze";
const std::string k_HSVPresetName = "hsv";
const std::string k_JetPresetName = "jet";
const std::string k_JetPresetName = "Jet";
const std::string k_RainbowBlendedBlackPresetName = "Rainbow Blended Black";
const std::string k_RainbowBlendedGreyPresetName = "Rainbow Blended Grey";
const std::string k_RainbowBlendedWhitePresetName = "Rainbow Blended White";
const std::string k_RainbowDesaturatedPresetName = "Rainbow Desaturated";
const std::string k_RainbowPresetName = "rainbow";
const std::string k_RainbowPresetName = "Rainbow";
const std::string k_XRayPresetName = "X Ray";

std::map<std::string, nlohmann::json> ReadPresets()
Expand All @@ -58,7 +58,7 @@ std::map<std::string, nlohmann::json> ReadPresets()
std::map<std::string, nlohmann::json> presetsMap;
for(const nlohmann::json& preset : result.value())
{
if(preset.contains("Name") && preset.contains("RGBPoints") && preset["Name"].is_string())
if(ColorTableUtilities::IsValidPreset(preset))
{
presetsMap.insert({preset["Name"].get<std::string>(), preset});
}
Expand Down Expand Up @@ -188,31 +188,33 @@ TEST_CASE("SimplnxCore::GenerateColorTableFilter: Valid filter execution")
presetFilePath = k_XRayPresetPath;
}

args.insertOrAssign(GenerateColorTableFilter::k_SelectedDataArrayPath_Key, std::make_any<DataPath>(DataPath{{Constants::k_Confidence_Index.str()}}));
args.insertOrAssign(GenerateColorTableFilter::k_RgbArrayPath_Key, std::make_any<std::string>("CI_RGB"));
{
args.insertOrAssign(GenerateColorTableFilter::k_SelectedDataArrayPath_Key, std::make_any<DataPath>(DataPath{{Constants::k_Confidence_Index.str()}}));
args.insertOrAssign(GenerateColorTableFilter::k_RgbArrayPath_Key, std::make_any<std::string>("CI_RGB"));

IFilter::ExecuteResult executeResult = filter.execute(dataStructure, args);
SIMPLNX_RESULT_REQUIRE_VALID(executeResult.result)
IFilter::ExecuteResult executeResult = filter.execute(dataStructure, args);
SIMPLNX_RESULT_REQUIRE_VALID(executeResult.result)

// Validate Results
REQUIRE_NOTHROW(dataStructure.getDataRefAs<UInt8Array>(DataPath{{"CI_RGB"}}));
const UInt8Array& resultArray = dataStructure.getDataRefAs<UInt8Array>(DataPath{{"CI_RGB"}});
const AbstractDataStore<uint8>& resultStore = resultArray.getDataStoreRef();
// Validate Results
REQUIRE_NOTHROW(dataStructure.getDataRefAs<UInt8Array>(DataPath{{"CI_RGB"}}));
const UInt8Array& resultArray = dataStructure.getDataRefAs<UInt8Array>(DataPath{{"CI_RGB"}});
const AbstractDataStore<uint8>& resultStore = resultArray.getDataStoreRef();

std::string buf;
std::ifstream inStream(presetFilePath);
usize currentLine = 0;
while(!inStream.eof())
{
std::getline(inStream, buf);
std::vector<std::string> list = StringUtilities::split(buf, ',');
for(int i = 0; i < list.size(); i++)
std::string buf;
std::ifstream inStream(presetFilePath);
usize currentLine = 0;
while(!inStream.eof())
{
REQUIRE_NOTHROW(std::stoi(list[i]));
const uint8 exemplar = std::stoi(list[i]);
const uint8 generated = resultStore.getComponentValue(currentLine, i);
REQUIRE(exemplar == generated);
std::getline(inStream, buf);
std::vector<std::string> list = StringUtilities::split(buf, ',');
for(int i = 0; i < list.size(); i++)
{
REQUIRE_NOTHROW(std::stoi(list[i]));
const uint8 exemplar = std::stoi(list[i]);
const uint8 generated = resultStore.getComponentValue(currentLine, i);
REQUIRE(exemplar == generated);
}
currentLine++;
}
currentLine++;
}
}
24 changes: 23 additions & 1 deletion src/simplnx/Utilities/ColorTableUtilities.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "ColorTableUtilities.hpp"

#include "simplnx/Utilities/StringUtilities.hpp"
#include "simplnx/util/ColorTable.hpp"

#include <fmt/format.h>
Expand All @@ -8,16 +9,37 @@

using namespace nx::core;

bool ColorTableUtilities::IsValidPreset(const nlohmann::json& preset)
{
bool hasRgbPoints = preset.contains("RGBPoints");
bool rgbPointsIsArray = (hasRgbPoints && preset["RGBPoints"].is_array() ? true : false);
bool hasColorSpace = preset.contains("ColorSpace");
std::string colorSpaceValue = (hasColorSpace ? preset["ColorSpace"].get<std::string>() : "");

if(rgbPointsIsArray && (hasColorSpace && (colorSpaceValue == "RGB" || colorSpaceValue == "Diverging" || colorSpaceValue == "Lab" || colorSpaceValue == "CIELAB")))
{
return true;
}
return false;
}

Result<nlohmann::json> ColorTableUtilities::LoadAllRGBPresets()
{
nlohmann::json rgbPresets;

for(const auto& preset : ColorTable::k_DefaultColorTableJson)
{
if(preset.contains("RGBPoints") && preset["RGBPoints"].is_array())
if(IsValidPreset(preset))
{
rgbPresets.push_back(preset);
}
}

// Sort the presets by name
std::sort(rgbPresets.begin(), rgbPresets.end(), [](const nlohmann::json& a, const nlohmann::json& b) {
return nx::core::StringUtilities::toLower(a["Name"].get<std::string>()) < nx::core::StringUtilities::toLower(b["Name"].get<std::string>());
});

return {rgbPresets};
}

Expand Down
7 changes: 7 additions & 0 deletions src/simplnx/Utilities/ColorTableUtilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ SIMPLNX_EXPORT Result<std::vector<float32>> ExtractControlPoints(const std::stri
* @return The string name of the first RGB preset or empty string if none found
*/
SIMPLNX_EXPORT std::string GetDefaultRGBPresetName();

/**
* @brief IsValidPreset Returns true if the preset has has the "RGBPoints" and "ColorSpace" keys
* @return
*/
SIMPLNX_EXPORT bool IsValidPreset(const nlohmann::json& preset);

} // namespace nx::core::ColorTableUtilities

0 comments on commit c954a26

Please sign in to comment.