Loading src/main/java/Aberration_Calibration.java +7 −1 Original line number Diff line number Diff line Loading @@ -5984,9 +5984,15 @@ if (MORE_BUTTONS) { IJ.showMessage("LENS_DISTORTION.fittingStrategy is not set"); return; } boolean [] selectedChannels=null; if (ABERRATIONS_PARAMETERS!=null){ selectedChannels=ABERRATIONS_PARAMETERS.getChannelSelection(LENS_DISTORTIONS); } LENS_DISTORTIONS.removeOutLayers( -1, //int series, (<0 - ask) -1 //int numOutLayers (<0 - ask) -1, //int numOutLayers (<0 - ask) selectedChannels ); return; } Loading src/main/java/Distortions.java +26 −6 Original line number Diff line number Diff line Loading @@ -3676,14 +3676,23 @@ List calibration return true; } public boolean removeOutLayers(int series, int numOutLayers){ public boolean removeOutLayers( int series, int numOutLayers, boolean [] selectedChannels){ int numSeries=fittingStrategy.getNumSeries(); boolean removeEmpty=false; boolean recalculate=false; boolean applyChannelFilter=false; int filter=filterForAll; if ((series<0) || (numOutLayers<0)) { GenericDialog gd = new GenericDialog("Select series to process"); gd.addNumericField("Iteration number to start (0.."+(numSeries-1)+")", this.seriesNumber, 0); if (selectedChannels != null) { String s=""; for (boolean b:selectedChannels)s+=b?"+":"-"; gd.addCheckbox("Filter by channel selection ("+s+")", applyChannelFilter); } gd.addCheckbox("Recalculate parameters vector from selected strategy",recalculate); gd.addNumericField("Number of outlayers to show", 10, 0); gd.addCheckbox("Remove empty (rms==NaN) images", removeEmpty); Loading @@ -3691,6 +3700,7 @@ List calibration gd.showDialog(); if (gd.wasCanceled()) return false; this.seriesNumber= (int) gd.getNextNumber(); if (selectedChannels != null) applyChannelFilter= gd.getNextBoolean(); recalculate= gd.getNextBoolean(); numOutLayers= (int) gd.getNextNumber(); removeEmpty= gd.getNextBoolean(); Loading @@ -3700,12 +3710,22 @@ List calibration } else { this.seriesNumber=series; } if (!applyChannelFilter) selectedChannels=null; // initFittingSeries(!recalculate,this.filterForAll,this.seriesNumber); // will set this.currentVector initFittingSeries(!recalculate,this.filterForAll,this.seriesNumber); // will set this.currentVector this.currentfX=calculateFxAndJacobian(this.currentVector, false); // is it always true here (this.jacobian==null) double [] errors=calcErrors(calcYminusFx(this.currentfX)); // seem to have errors? - now may return NaN! double rms= calcError (calcYminusFx(this.currentfX)); boolean [] selectedImages=fittingStrategy.selectedImages(); if (selectedChannels!=null){ selectedImages=selectedImages.clone(); // disconnect from original for modification for (int i=0;i<selectedImages.length;i++) if (selectedImages[i]){ int chn=this.fittingStrategy.distortionCalibrationData.gIP[i].channel; if ((chn<0) || (chn>=selectedChannels.length) || !selectedChannels[chn]){ selectedImages[i]=false; } } } int numSelectedNotNaNImages=0; int numNaN=0; for (int i=0;i<selectedImages.length;i++) if (selectedImages[i]) { Loading
src/main/java/Aberration_Calibration.java +7 −1 Original line number Diff line number Diff line Loading @@ -5984,9 +5984,15 @@ if (MORE_BUTTONS) { IJ.showMessage("LENS_DISTORTION.fittingStrategy is not set"); return; } boolean [] selectedChannels=null; if (ABERRATIONS_PARAMETERS!=null){ selectedChannels=ABERRATIONS_PARAMETERS.getChannelSelection(LENS_DISTORTIONS); } LENS_DISTORTIONS.removeOutLayers( -1, //int series, (<0 - ask) -1 //int numOutLayers (<0 - ask) -1, //int numOutLayers (<0 - ask) selectedChannels ); return; } Loading
src/main/java/Distortions.java +26 −6 Original line number Diff line number Diff line Loading @@ -3676,14 +3676,23 @@ List calibration return true; } public boolean removeOutLayers(int series, int numOutLayers){ public boolean removeOutLayers( int series, int numOutLayers, boolean [] selectedChannels){ int numSeries=fittingStrategy.getNumSeries(); boolean removeEmpty=false; boolean recalculate=false; boolean applyChannelFilter=false; int filter=filterForAll; if ((series<0) || (numOutLayers<0)) { GenericDialog gd = new GenericDialog("Select series to process"); gd.addNumericField("Iteration number to start (0.."+(numSeries-1)+")", this.seriesNumber, 0); if (selectedChannels != null) { String s=""; for (boolean b:selectedChannels)s+=b?"+":"-"; gd.addCheckbox("Filter by channel selection ("+s+")", applyChannelFilter); } gd.addCheckbox("Recalculate parameters vector from selected strategy",recalculate); gd.addNumericField("Number of outlayers to show", 10, 0); gd.addCheckbox("Remove empty (rms==NaN) images", removeEmpty); Loading @@ -3691,6 +3700,7 @@ List calibration gd.showDialog(); if (gd.wasCanceled()) return false; this.seriesNumber= (int) gd.getNextNumber(); if (selectedChannels != null) applyChannelFilter= gd.getNextBoolean(); recalculate= gd.getNextBoolean(); numOutLayers= (int) gd.getNextNumber(); removeEmpty= gd.getNextBoolean(); Loading @@ -3700,12 +3710,22 @@ List calibration } else { this.seriesNumber=series; } if (!applyChannelFilter) selectedChannels=null; // initFittingSeries(!recalculate,this.filterForAll,this.seriesNumber); // will set this.currentVector initFittingSeries(!recalculate,this.filterForAll,this.seriesNumber); // will set this.currentVector this.currentfX=calculateFxAndJacobian(this.currentVector, false); // is it always true here (this.jacobian==null) double [] errors=calcErrors(calcYminusFx(this.currentfX)); // seem to have errors? - now may return NaN! double rms= calcError (calcYminusFx(this.currentfX)); boolean [] selectedImages=fittingStrategy.selectedImages(); if (selectedChannels!=null){ selectedImages=selectedImages.clone(); // disconnect from original for modification for (int i=0;i<selectedImages.length;i++) if (selectedImages[i]){ int chn=this.fittingStrategy.distortionCalibrationData.gIP[i].channel; if ((chn<0) || (chn>=selectedChannels.length) || !selectedChannels[chn]){ selectedImages[i]=false; } } } int numSelectedNotNaNImages=0; int numNaN=0; for (int i=0;i<selectedImages.length;i++) if (selectedImages[i]) {