embl-cba / spindle3d

0 stars 0 forks source link

DNA thresholding gone wrong #8

Closed TobiasKletter closed 4 years ago

TobiasKletter commented 4 years ago

Despite clean DNA signal, sometimes this happens:

image

https://www.dropbox.com/s/0jtu2lqdystyd3h/20200826_HeLa309_TubGFP_SiRDNA__PFAGA_NoMounting_005-1.tif?dl=0

## Spindle Morphometry Settings
workingVoxelSize: 0.25
dnaThresholdResolution: 1.5
dnaThresholdFactor: 0.5
spindleDerivativeDelta: 1.0
minimalDynamicRange: 7
minimalDnaFragmentsVolume: 5.0
maxCentralObjectRegionsDistance: 7.0
erosionOfDnaMaskInCalibratedUnits: 1.0

## Spindle Morphometry Measurement
Processing file 20200826_HeLa309_TubGFP_SiRDNA__PFAGA_NoMounting_005-1.tif
Create isotropic images...
DNA initial threshold: 525.0
Remove small regions...
Determining DNA axes...
Creating aligned images...
Measuring DNA axial extend...
DNA axial profile threshold 0: 635.3881379310345
DNA axial profile threshold 1: 620.2187586206896
Measuring DNA lateral extend...
DNA lateral profile threshold 1044.7142857142858
DNA Otsu threshold: 787.0
Remove small regions...
Spindle threshold: NaN
Computing mask...
Computing mask...
Creating projection of spindle mask along spindle axis...
Version: Spindle Morphometry Version: 0.7.0
DNA_Initial_Threshold: 525.0
DNA_Volume_Threshold: 787.0
DNA_Width_um: 14.0
DNA_Length_um: 4.0
DNA_Volume_um3: 600.15625
DNA_Normalised_Central_Intensity: 0.9482005204497471
Spindle_Pole_Refinement_Distance_PoleA_um: 1.0606601717798212
Spindle_Pole_Refinement_Distance_PoleB_um: 2.8722813232690143
Spindle_Length_um: 11.858541225631422
Spindle_Intensity_Threshold: NaN
Spindle_Volume_um3: 0.0
Spindle_Width_Min_um: 0.0
Spindle_Width_Max_um: 0.0
Dna_Center_To_Spindle_Center_Distance_um: 6.207354508967568
Spindle_Axis_To_Coverslip_Plane_Angle_Degrees: 72.50992265333723
Spindle_Tubulin_CoV: NaN
Spindle_Tubulin_Sum: NaN
Analysis finished.
TobiasKletter commented 4 years ago

Another sample, but less grave: image https://www.dropbox.com/s/14qaatv5k0ck7ms/20200826_R1E309_TubGFP_SiRDNA__PFAGA_NoMounting_014-2.tif?dl=0

edit: Here I could solve the problem by pre-processing the original with background subtraction (rolling ball radius 50)

tischi commented 4 years ago

The issue with these images seems to be that there is a very high offset of the signal (here around 500 gray values). I will try to change the code to handle this.

image

tischi commented 4 years ago

I think I fixed it:

image

The initial threshold was too low due to the offset. I am accounting now for the image offset when computing the initial threshold:

        Pair< Double, Double > minMaxValues = Algorithms.getMinMaxValues( dnaDownscaledToMetaphasePlateWidth );
        Logger.log( "DNA downscaled minimum value: " + minMaxValues.getA()  );
        Logger.log( "DNA downscaled maximum value: " + minMaxValues.getB()  );
        Logger.log( "DNA initial threshold factor: " + settings.dnaThresholdFactor );
        double initialDnaThreshold = ( minMaxValues.getB() - minMaxValues.getA() ) * settings.dnaThresholdFactor + minMaxValues.getA() ;
        Logger.log( "DNA initial threshold (max-min)*factor + min: " + initialDnaThreshold );
tischi commented 4 years ago

I pushed a new version 0.7.1 including the changes. Please try it out and let me know how it works.