Skip to content

Commit

Permalink
zero iterations case
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatrukha committed Apr 23, 2024
1 parent ae6b983 commit 5bbe81e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>nl.uu.science.cellbiology</groupId>
<artifactId>AveragingND</artifactId>
<version>0.0.4-SNAPSHOT</version>
<version>0.1.0-SNAPSHOT</version>

<name>AveragingND</name>
<description>Averaging of ND images using normalized cross-correlation. </description>
Expand Down
23 changes: 17 additions & 6 deletions src/main/java/averagingND/IterativeAveraging.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ public void run(String paramString) {
sumAndCount = AverageWithoutZero.sumAndCountArray(imgs_shift);

IntervalView<FloatType> currAverageImg;
if(bIntermediateAverage)
if(bIntermediateAverage && nIterN>0)
{
processIntermediate(0);
}
Expand Down Expand Up @@ -341,9 +341,21 @@ public void run(String paramString) {
maxAverCCshifts.add(new long[nDimReg]);
}

//initial iteration
int iterBeg = 0;
//for zero iterations we want to do one without shifts
if(nIterN == 0)
{
iterBeg=-1;
lim_fractions = null;
limInterval = new FinalInterval(new long [nDimReg], new long [nDimReg]);
//no need to save, since they are the same
bOutputInput = false;
}

long iterStartT, iterEndT;

for(iter=0;(iter<nIterN && !bConverged);iter++)
for(iter=iterBeg;(iter<nIterN && !bConverged);iter++)
{
IJ.showStatus("Averaging iteration "+Integer.toString(iter+1)+"...");
avrgCC = 0.0;
Expand Down Expand Up @@ -453,15 +465,14 @@ public void run(String paramString) {
{
IJ.log("Best result: iteration #" + Integer.toString(nIterMax) + " with average CC " + df.format(maxAverCC));

ptable.show("Results");
ptableCC.show("Average CC");
shifts = maxAverCCshifts;
}
else
{
IJ.log("Iteration count is equal to zero, no registration was done, just averaging.");
}

ptable.show("Results");
ptableCC.show("Average CC");
shifts = maxAverCCshifts;

//calculate final average image
IJ.log("calculating final average image..");
Expand Down
1 change: 1 addition & 0 deletions src/main/java/averagingND/MiscUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public static < T extends Comparable< T > & Type< T > > T computeMaxLocation(
// initialize min and max with the first image value
T type = cursor.next();
T max = type.copy();
maxLocation.setPosition( cursor );

// loop over the rest of the data and determine min and max value
while ( cursor.hasNext() )
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/averagingND/RegisterSingleND.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ public static void main( final String[] args ) throws ImgIOException, Incompatib

//IJ.open("/home/eugene/Desktop/projects/RegisterNDFFT/4d/HyperStack.tif");
//IJ.open("/home/eugene/Desktop/projects/RegisterNDFFT/4d/HyperStack-1.tif");
IJ.open("/home/eugene/Desktop/projects/RegisterNDFFT/centered/full.tif");
IJ.open("/home/eugene/Desktop/projects/RegisterNDFFT/centered/center.tif");
IJ.open("/home/eugene/Desktop/projects/RegisterNDFFT/center/full.tif");
IJ.open("/home/eugene/Desktop/projects/RegisterNDFFT/center/center.tif");


RegisterSingleND test = new RegisterSingleND();
Expand Down

0 comments on commit 5bbe81e

Please sign in to comment.