Closed ctrueden closed 5 years ago
@maarzt Can you look into this?
My thoughts on this:
DatasetIOService
returns a SCIFIOCellImg
with planar cells. I can add a wrapper SCIFIOCellImg
to VirtualStack
which will eliminate the need to copy data for unsigned byte, unsigned short and float images.ImageJVirtualStackUnsignedByte$ByteConverter
converts from RealType
to UnsignedByteType
. I can add a special converter that simply copies UnsignedByteType
to UnsignedByteType
with no extra conversion.It's on my todo list.
Consider the following Groovy script:
This pops up the huge image very quickly, which is awesome.
But now put a breakpoint at
org.scijava.ui.DefaultUIService
line 381 oforg.scijava:scijava-common:2.73.1
; this will be the lineui.show(display)
insideonEvent(DisplayCreated)
. Run the same script above, and it will break there. Then STEP instead of CONTINUE. The step now hangs, withIterableIntervalProjector2D.map
taking forever to complete. (I waited minutes, and it still was not done.)Here are some example stack traces of what is going on during the step, retrieved from the CLI using ctrl+\:
The gist is that
IterableIntervalProjector2D.map
uses aImageJVirtualStackUnsignedByte$ByteConverter
to do an identity conversion fromUnsignedByteType
toUnsignedByteType
—i.e. no value adjustment. I am guessing that when stepping in the debugger, we do not gain the full benefits of JIT/inlining, so end up looping over all samples. Even then, it seems odd it is so slow... but regardless, this code path is highly suboptimal. Would be much better not to use the converter at all in circumstances where the source type already matches.