Skip to content

Commit

Permalink
tracks group name generation changed
Browse files Browse the repository at this point in the history
  • Loading branch information
ekatrukha committed Jun 28, 2024
1 parent 31c6e4d commit 6589587
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
5 changes: 0 additions & 5 deletions src/main/java/bigtrace/BigTraceData.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,6 @@ public class BigTraceData < T extends RealType< T > & NativeType< T > > {
/** value of the intensity threshold to stop One click tracing **/
public double dOCIntensityThreshold;

////////////////////////// TRACKING

/** for now, generate a number of the track **/

public static AtomicInteger nTrackN = new AtomicInteger(1);

///////////////// DEFAULT SETTINGS FOR UNDEFINED GROUP

Expand Down
32 changes: 31 additions & 1 deletion src/main/java/bigtrace/tracks/CurveTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected Void doInBackground() throws Exception
setProgress(0);

//make a New Group
newGroupTrack = new Roi3DGroup( currentRoi, String.format("%03d", BigTraceData.nTrackN.getAndIncrement()));
newGroupTrack = new Roi3DGroup( currentRoi, getNewGroupNameInteger());

bt.roiManager.addGroup( newGroupTrack );
bt.roiManager.applyGroupToROI( currentRoi, newGroupTrack );
Expand Down Expand Up @@ -255,5 +255,35 @@ public void done()
// bvv_trace = BvvFunctions.show(btdata.trace_weights, "weights", Bvv.options().addTo(bvv_main));

}

String getNewGroupNameInteger()
{

int nCand = 1;
boolean bFoundGood = false;
boolean bExistsAlready;
String sCandName = String.format("%03d", nCand);
while (!bFoundGood)
{
bExistsAlready = false;
for (int i=0;i<bt.roiManager.groups.size() && !bExistsAlready;i++)
{
if(sCandName.equals( bt.roiManager.groups.get( i ).getName() ))
{
bExistsAlready = true;
}
}
if(bExistsAlready)
{
nCand++;
sCandName = String.format("%03d", nCand);
}
else
{
return sCandName;
}
}
return "Error";
}

}

0 comments on commit 6589587

Please sign in to comment.