File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -492,9 +492,15 @@ public uint AcquisitionDepth
492492 }
493493 else
494494 {
495- double log2OfRatio = Math . Log ( ( double ) value / OVERVIEW_LENGTH , 2 ) ;
496- if ( log2OfRatio != ( int ) log2OfRatio && ! isAudio )
497- throw new ValidationException ( "Acquisition depth must be " + OVERVIEW_LENGTH + " * 2^N --- " + log2OfRatio . ToString ( ) + " vs " + ( ( int ) log2OfRatio ) . ToString ( ) ) ;
495+ double log2OfRatio = Math . Log ( ( double ) value / OVERVIEW_LENGTH , 2 ) ;
496+ if ( log2OfRatio != ( int ) log2OfRatio && ! isAudio )
497+ {
498+ //this only happens on some platforms. If it happens, the difference is like 20,9999999996641 vs 20
499+ //probably rounding issue -> round and correct instead of crash
500+ Logger . Error ( "Acquisition depth must be " + OVERVIEW_LENGTH + " * 2^N --- " + log2OfRatio . ToString ( ) + " vs " + ( ( int ) log2OfRatio ) . ToString ( ) ) ;
501+ log2OfRatio = ( int ) Math . Round ( log2OfRatio ) ;
502+ value = ( uint ) Math . Pow ( 2 , log2OfRatio ) ;
503+ }
498504 if ( value > ACQUISITION_DEPTH_MAX )
499505 acquisitionDepth = ACQUISITION_DEPTH_MAX ;
500506 else
You can’t perform that action at this time.
0 commit comments