Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,34 @@ namespace Seg3D
bool ActionHistogramEqualizationFilter::validate( Core::ActionContextHandle& context )
{
// Make sure that the sandbox exists
if ( !LayerManager::CheckSandboxExistence( this->sandbox_, context ) ) return false;
if ( ! LayerManager::CheckSandboxExistence( this->sandbox_, context ) ) return false;

// Check for layer existence and type information
if ( ! LayerManager::CheckLayerExistenceAndType( this->target_layer_,
Core::VolumeType::DATA_E, context, this->sandbox_ ) ) return false;
Core::VolumeType::DATA_E, context, this->sandbox_ ) ) return false;

// Check for layer availability
if ( ! LayerManager::CheckLayerAvailability( this->target_layer_,
this->replace_, context, this->sandbox_ ) ) return false;
this->replace_, context, this->sandbox_ ) ) return false;

// Check amount
if( this->amount_ < 0.0 || this->amount_ > 1.0 )
if ( ( this->amount_ < 0.0 ) || (this->amount_ > 1.0 ) )
{
context->report_error( "Equalization amount needs to be between 0.0 and 1.0." );
return false;
}

// Check bins
if( this->bins_ < 2 )
if ( this->bins_ < 2 )
{
context->report_error( "Bins needs to be bigger than 1." );
context->report_error( "Number of bins needs to be bigger than 1." );
return false;
}

// Check how many bins to ignore
if( this->ignore_bins_ < 0 )
if ( ( this->ignore_bins_ < 0 ) || ( this->ignore_bins_ >= this->bins_ ) )
{
context->report_error( "Number of bins to ignore needs to be bigger than or equal to 0." );
context->report_error( "Number of bins to ignore must be greater than 0 and less than number of bins." );
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Application/Tools/HistogramEqualizationFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ HistogramEqualizationFilter::HistogramEqualizationFilter( const std::string& too
this->add_state( "replace", this->replace_state_, false );
this->add_state( "amount", this->amount_state_, 1.0, 0.0, 1.0, 0.01 );
this->add_state( "bins", this->bins_state_, 3000, 10, 10000, 1 );
this->add_state( "ignore_bins", this->ignore_bins_state_, 1, 0, 10, 1 );
this->add_state( "ignore_bins", this->ignore_bins_state_, 1, 0, 10000, 1 );
}

HistogramEqualizationFilter::~HistogramEqualizationFilter()
Expand Down