Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crazy Interactive DoG #55

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,19 @@ public static <L extends RealLocalizable> void drawRealLocalizable(final Collect

for (final L peak : peaks) {

// we only draw a 3d peak when it is +- 1.0 pixel away
if ( peak.numDimensions() > 2 && imp.getNSlices() > 1 )
if ( Math.abs( peak.getDoublePosition( 2 ) - currentSlice ) > 1.0 )
continue;

// determine Z distance from peak center and adjust scale radius
final float x = peak.getFloatPosition(0);
final float y = peak.getFloatPosition(1);

// +0.5 is to center in on the middle of the detection pixel
final OvalRoi or = new OvalRoi(x - radius + 0.5, y - radius + 0.5, radius * 2, radius * 2);
or.setStrokeColor(col);
overlay.add(or);
final float zDistance = Math.abs(peak.getFloatPosition(2) - currentSlice) + 1;
double drawRadius = 1.5 * radius / Math.sqrt( zDistance );

// only draw nearby peaks
if ( drawRadius > 0.67 )
{
final OvalRoi or = new OvalRoi(x - radius + 0.5, y - radius + 0.5, drawRadius * 2, drawRadius * 2);
or.setStrokeColor(col);
overlay.add(or);
}
}

// this part might be useful for debugging
Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks so much for going through this. I am not sure that the extension of the z-range works as you intended, but I'll try it out!

Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ protected void updatePreview(final ValueChange change) {
min = new long []{
rectangle.x,
rectangle.y,
Math.max( imgTmp.min( 2 ), currentSlice - 1 ) };
Math.max( imgTmp.min( 2 ), currentSlice - (long) (2.5 * Math.ceil(params.sigma) ) ) };
max = new long []{
rectangle.width + rectangle.x - 1,
rectangle.height + rectangle.y - 1,
Math.min( imgTmp.max( 2 ), currentSlice + 1 ) };
Math.min( imgTmp.max( 2 ), currentSlice + (long) (2.5 * Math.ceil(params.sigma) ) ) };
}
else { // 2d or 2d+t case

Expand All @@ -296,8 +296,8 @@ protected void updatePreview(final ValueChange change) {
}

final double radius = ( ( params.sigma + HelperFunctions.computeSigma2( params.sigma, sensitivity ) ) / 2.0 );
final ArrayList< RefinedPeak< Point > > filteredPeaksMax = HelperFunctions.filterPeaks( peaksMax, rectangle, params.threshold );
final ArrayList< RefinedPeak< Point > > filteredPeaksMin = HelperFunctions.filterPeaks( peaksMin, rectangle, params.threshold );
final ArrayList< RefinedPeak< Point > > filteredPeaksMax = HelperFunctions.filterPeaks( peaksMax, rectangle, params.threshold / 2.5 ); // correction factor of 2.5 applied to match thresholding in final DoG IP detection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering why this makes sense (I assume you tested it and it does make sense) ... will test this as well and merge for now, thanks so much!

final ArrayList< RefinedPeak< Point > > filteredPeaksMin = HelperFunctions.filterPeaks( peaksMin, rectangle, params.threshold / 2.5 ); // correction factor of 2.5 applied to match thresholding in

HelperFunctions.drawRealLocalizable( filteredPeaksMax, imagePlus, radius, Color.RED, true );
HelperFunctions.drawRealLocalizable( filteredPeaksMin, imagePlus, radius, Color.GREEN, false );
Expand Down
Loading