diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/controller/PreprocessingController.java b/src/main/java/fr/pasteur/ida/zellige/gui/controller/PreprocessingController.java index 242c45443aa8e4c53b74736da5702bd82fead883..115c5489b6ce4c3231a900a5f4b404108d260394 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/controller/PreprocessingController.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/controller/PreprocessingController.java @@ -194,14 +194,15 @@ public class PreprocessingController< T extends RealType< T > & NativeType< T > /** * Finds and sets the input color tables. + * * @param index the position of the input in the list of displayed datasets */ - public void setColorTable( int index) + public void setColorTable( int index ) { ImageDisplayService imageDisplayService = parentController.getMainAppFrame().getImage(); - DatasetView datasetView = ( DatasetView ) imageDisplayService.getImageDisplays().get(index).get( 0 ); - ArrayList<ColorTable> colorTables = new ArrayList<>(datasetView.getColorTables()); - getModel().getColors().set( colorTables ); + DatasetView datasetView = ( DatasetView ) imageDisplayService.getImageDisplays().get( index ).get( 0 ); + ArrayList< ColorTable > colorTables = new ArrayList<>( datasetView.getColorTables() ); + getModel().getColors().set( colorTables ); } @@ -252,7 +253,14 @@ public class PreprocessingController< T extends RealType< T > & NativeType< T > getModel().getChannel().set( channelValue.getValue() - 1 ); } // Set the input channel - getModel().getInput_channel().set( Views.hyperSlice( getModel().getInput().get(), 2, getModel().getChannel().get() ) ); + if ( getModel().getInput().get() == null ) + { + showError( new NoInputException() ); + } + else + { + getModel().getInput_channel().set( Views.hyperSlice( getModel().getInput().get(), 2, getModel().getChannel().get() ) ); + } } private void disableParameters() @@ -289,7 +297,7 @@ public class PreprocessingController< T extends RealType< T > & NativeType< T > public void setParameters( ZelligeParameters parameters ) { - binValue.getValueFactory().setValue(parameters.getPretreatmentParameters().getBin()); - channelValue.getValueFactory().setValue(parameters.getPretreatmentParameters().getChannel()); + binValue.getValueFactory().setValue( parameters.getPretreatmentParameters().getBin() ); + channelValue.getValueFactory().setValue( parameters.getPretreatmentParameters().getChannel() ); } } \ No newline at end of file