Skip to content

Commit

Permalink
fix: the default value of discretization is 256
Browse files Browse the repository at this point in the history
  • Loading branch information
gapry committed Nov 30, 2024
1 parent 5df8019 commit dd9c2b8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion application/F3DOptionsTools.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static inline const std::array<CLIGroup, 8> CLIOptions = {{
{"bar", "b", "Show scalar bar", "<bool>", "1" },
{"colormap-file", "", "Specify a colormap image", "<filePath/filename/fileStem>", ""},
{"colormap", "", "Specify a custom colormap (ignored if \"colormap-file\" is specified)", "<color_list>", ""},
{"colormap-discretization", "", "Specify the discretization of the colormap", "<int>", "-1"},
{"colormap-discretization", "", "Specify the discretization of the colormap", "<int>", "256"},
{"volume", "v", "Show volume if the file is compatible", "<bool>", "1"},
{"inverse", "i", "Inverse opacity function for volume rendering", "<bool>", "1"} } },
{"Camera",
Expand Down
2 changes: 1 addition & 1 deletion library/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
},
"discretization" : {
"type": "int",
"default_value": "-1"
"default_value": "256"
},
"range": {
"type": "double_vector"
Expand Down
8 changes: 4 additions & 4 deletions vtkext/private/module/vtkF3DRenderer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void vtkF3DRenderer::Initialize()

this->GridInfo = "";

this->Discretization = -1;
this->Discretization = 256;
this->DiscretizableColorTransferFunctionConfigured = false;

this->AddActor2D(this->ScalarBarActor);
Expand Down Expand Up @@ -2136,14 +2136,14 @@ void vtkF3DRenderer::SetColorDiscretization(const int discretization) {
std::string("[Gapry PoC][Add CLI Options] ") +
"input discretization = " + std::to_string(discretization));

if(discretization >= 0 && discretization <= 255) {
if(discretization >= 0 and discretization <= std::numeric_limits<int>::max()) {
this->Discretization = discretization;

vtkF3DMetaImporter::ColoringInfo info;
this->ConfigureRangeAndCTFForColoring(info);
} else {
F3DLog::Print(F3DLog::Severity::Error,
"The discretization value is between 0 and 255.");
"The discretization value need to great than zero");
}
}

Expand Down Expand Up @@ -2495,7 +2495,7 @@ void vtkF3DRenderer::ConfigureRangeAndCTFForColoring(
}

// Set Discretization
if(this->Discretization >= 0 && !this->DiscretizableColorTransferFunctionConfigured) {
if(!this->DiscretizableColorTransferFunctionConfigured) {
F3DLog::Print(F3DLog::Severity::Warning,
std::string("[Gapry PoC][Add CLI Options] " ) + __PRETTY_FUNCTION__ +
" discretization = " + std::to_string(this->Discretization));
Expand Down
2 changes: 1 addition & 1 deletion vtkext/private/module/vtkF3DRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ class vtkF3DRenderer : public vtkOpenGLRenderer

vtkNew<vtkDiscretizableColorTransferFunction> DiscretizableColorTransferFunction;
bool DiscretizableColorTransferFunctionConfigured = false;
int Discretization = -1;
int Discretization = 256;

vtkNew<vtkScalarBarActor> ScalarBarActor;
bool ScalarBarActorConfigured = false;
Expand Down

0 comments on commit dd9c2b8

Please sign in to comment.