Skip to content

Commit

Permalink
added logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatrukha committed Apr 17, 2024
1 parent 2d62a77 commit 5901828
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/main/java/averagingND/ConstantsAveragingND.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package averagingND;

public interface ConstantsAveragingND {
public static final String sVersion="0.0.4";
}
38 changes: 32 additions & 6 deletions src/main/java/averagingND/IterativeAveraging.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ public class IterativeAveraging implements PlugIn, DialogListener {

/** set of images for averaging and information about them **/
ImageSet imageSet;

/** constrains during the averaging
* 0 - no constrains
* 1 - constrains in pixels
* 2 - constrains as a fraction of max displacement
* **/
public int nConstrainReg = 0;

Label [] limName;
TextField [] limVal;
/** dimensions of dataset for averaging (always 1 channel) **/
Expand All @@ -69,6 +74,11 @@ public void run(String paramString) {

double [] dLimits;

//double format formatting toold
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator('.');
DecimalFormat df = new DecimalFormat ("#.########", symbols);
DecimalFormat df1 = new DecimalFormat ("#.#", symbols);

final String[] sInput = new String[2];
sInput[0] = "All currently open images";
Expand All @@ -80,7 +90,8 @@ public void run(String paramString) {
gdFiles.showDialog();

if ( gdFiles.wasCanceled() )
return;
return;
IJ.log("Iterative ND averaging plugin, version " + ConstantsAveragingND.sVersion);

nInput = gdFiles.getNextChoiceIndex();
Prefs.set("RegisterNDFFT.IA.nInput", sInput[nInput]);
Expand Down Expand Up @@ -181,22 +192,40 @@ public void run(String paramString) {
{
if(nConstrainReg == 1)
{
IJ.log("Averaging with constrain specified in voxels:");

for(d=0;d<nDimReg;d++)
{
dLimits[d]=Math.abs(gd1.getNextNumber());
Prefs.set("RegisterNDFFT.IA.dMax"+sDims.charAt(d)+"px",dLimits[d]);
IJ.log("Axis " +sDims.charAt(d)+": "+df1.format(dLimits[d])+" pixels");
}

}
else
{
IJ.log("Averaging with constrain specified as a fraction of max displacement:");
for(d=0;d<nDimReg;d++)
{
dLimits[d]=Math.min(Math.abs(gd1.getNextNumber()), 1.0);
Prefs.set("RegisterNDFFT.IA.dMax"+sDims.charAt(d)+"fr",dLimits[d]);
IJ.log("Axis " +sDims.charAt(d)+": "+df1.format(dLimits[d]));
}
}
}
else
{
IJ.log("Averaging without constrains.");
}
if(bExcludeZeros)
{
IJ.log("Excluding zeros: true.");
}
else
{
IJ.log("Excluding zeros: false.");
}

double [] lim_fractions = null;
FinalInterval limInterval = null;
if(nConstrainReg == 1)
Expand Down Expand Up @@ -276,10 +305,7 @@ public void run(String paramString) {
maxAverCCshifts.add(new long[nDimReg]);
}

DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator('.');
DecimalFormat df = new DecimalFormat ("#.########", symbols);
DecimalFormat df1 = new DecimalFormat ("#.#", symbols);


long iterStartT, iterEndT;

Expand Down

0 comments on commit 5901828

Please sign in to comment.