Skip to content

Commit

Permalink
minor fixes for NifTK#344
Browse files Browse the repository at this point in the history
- doc and unit test fixes for rgb hist. equil.
- adding rgb_histogram_equilisation to regression app
  • Loading branch information
wyli committed May 4, 2019
1 parent 91fce3f commit e0c5141
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/source/config_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ More specifically:
---- | ---- | ------- | -------
[normalisation](#normalisation) | `boolean` | `normalisation=True` | `False`
[whitening](#whitening) | `boolean` | `whitening=True` | `False`
[rgb_normalisation](#rgb_normalisation) | `boolean` | `rgb_normalisation=True` | `False`
[rgb_normalisation](#rgb-normalisation) | `boolean` | `rgb_normalisation=True` | `False`
[histogram_ref_file](#histogram-ref-file) | `string` | `histogram_ref_file=./hist_ref.txt` | `''`
[norm_type](#norm-type) | `string` | `norm_type=percentile` | `percentile`
[cutoff](#cutoff) | `float array (two elements)` | `cutoff=0.1, 0.9` | `0.01, 0.99`
Expand Down
7 changes: 7 additions & 0 deletions niftynet/application/regression_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
from niftynet.layer.rand_flip import RandomFlipLayer
from niftynet.layer.rand_rotation import RandomRotationLayer
from niftynet.layer.rand_spatial_scaling import RandomSpatialScalingLayer
from niftynet.layer.rgb_histogram_equilisation import \
RGBHistogramEquilisationLayer
from niftynet.evaluation.regression_evaluator import RegressionEvaluator
from niftynet.layer.rand_elastic_deform import RandomElasticDeformationLayer

Expand Down Expand Up @@ -100,12 +102,17 @@ def initialise_dataset_loader(
name='hist_norm_layer') \
if (self.net_param.histogram_ref_file and
self.net_param.normalisation) else None
rgb_normaliser = RGBHistogramEquilisationLayer(
image_name='image',
name='rbg_norm_layer') if self.net_param.rgb_normalisation else None

normalisation_layers = []
if histogram_normaliser is not None:
normalisation_layers.append(histogram_normaliser)
if mean_var_normaliser is not None:
normalisation_layers.append(mean_var_normaliser)
if rgb_normaliser is not None:
normalisation_layers.append(rgb_normaliser)

volume_padding_layer = []
if self.net_param.volume_padding_size:
Expand Down
2 changes: 1 addition & 1 deletion tests/rgb_histogram_equilisation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_equilisation(self):
cv2 = require_module('cv2', mandatory=False)

if cv2 is None:
self.skipTest()
self.skipTest('requires cv2 module')
return

def _get_histogram(img):
Expand Down

0 comments on commit e0c5141

Please sign in to comment.