bigdataviewer / bigdataviewer-playground

BSD 2-Clause "Simplified" License
19 stars 5 forks source link

wrong return value for SourceAndConverterHelper.getMaxTimepoint #251

Open tischi opened 2 years ago

tischi commented 2 years ago

I think I raised this before, but I cannot find it now: SourceAndConverterHelper.getMaxTimepoint returns the wrong results because the time points are 0 based. I think we should: return nFrames-1.

tischi commented 2 years ago

Another questions is why the code inside SourceAndConverterHelper.getMaxTimepoint needs to be so complex? Why not a simple for-loop to check whether a timepoint exists?

NicoKiaru commented 2 years ago

Hi Tischi, I/you can add more functions that would perform better. Because I am using this function everywhere, I'd suggest to let it exist and put a Deprecated annotation. This will let me the time to update its use in other repos.

Regarding the loop: I wanted the function to work with procedural sources which may return true whatever the timepoint input. If I search for a false return linearly, I'll end up with billions of calls. There may be alternatives (directly looking at Integer.MAX), but the linear search with a hard coded max did not look elegant.

tischi commented 2 years ago

OK, makes sense! If I find the time I will add an alternative function and add @Deprecated to this one. As mention in the mail, for yet unknown reasons, this functions takes a really long time for me in some specific context.