Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Curtis Rueden
    @ctrueden
    The only time I've seen this problem was in Lisbon, when the local network was caching a very stale version of the db.xml.gz file.
    If you are running Java 1.8.0_101 or later, you could try changing http to https in your manage update site dialog.
    Jan Eglinger
    @imagejan
    That is strange: I saw the same thing (1.51u being reported as up-to-date) on two other machines (one Windows 7, one Mac OSX), the Mac installation even was at 1.51s still and got updated to 1.51u...
    Switching to https triggered the update to 1.51v-SNAPSHOT on my debugging installation running with Java-1.8.0_144
    The others a running with the bundled 1.8.0_66 I think, and I didn't test https there.
    Not that is would be important for me, but it's a conundrum indeed.
    Curtis Rueden
    @ctrueden
    Since the switch to HTTPS works, I expect the problem is similar to Lisbon: stale HTTP cache of the network. We will avoid it in future by migrating everything to HTTPS.
    Jan Eglinger
    @imagejan
    Is there a way to display an image with a specific color map in a Jupyter notebook? If yes, is there some example somewhere in imagej/tutorials?
    Curtis Rueden
    @ctrueden
    @imagejan With a Python notebook, or SJJK notebook? Or you don't care which?
    Jan Eglinger
    @imagejan
    Img
    Jan Eglinger
    @imagejan
    ??? My posts from mobile vanished?
    I said I have an SJJK notebook. But anything is fine to display an Img with color map.
    Curtis Rueden
    @ctrueden
    The display mechanism between Python and SJJK is fundamentally different.
    SJJK implements its own image output.
    Whereas with Python, you can use matplotlib or other libraries to show things.
    Philipp Hanslovsky
    @hanslovsky
    For python, there is matplotlib.pyplot.imshow. If you have shared memory images (or don't mind the copy) you could use that.
    Curtis Rueden
    @ctrueden
    Let me see about SJJK...
    Curtis Rueden
    @ctrueden
    @imagejan Unfortunately, it appears the image rendering in SJJK is not yet flexible enough to do custom color tables.
    The RAI must be converted to a BufferedImage in order to be displayed. This happens here.
    In theory, a Dataset could be converted differently/better, since Dataset can have custom color tables attached.
    Jan Eglinger
    @imagejan
    @ctrueden ok
    A possibility might be to have a function that takes the current ColorTable8 and convert into a 3-channel RAI first...
    Curtis Rueden
    @ctrueden
    However, at the moment, it does not do anything smart.
    You could use an ImgLib2 Converters utility method to massage the data into a multi-channel view.
    Jan Eglinger
    @imagejan
    I see
    Curtis Rueden
    @ctrueden
    There are multiple places where color tables can end up being used: in an ImgLib2 Converter would be one of them.
    The other would be the CompositeXYProjector that is used by the SJJK as well as the ImageJ2 modern UI.
    The CompositeXYProjector lets you use whatever color table you want for each channel.
    Jan Eglinger
    @imagejan
    I’ll check it out...
    Thanks for the pointers.
    Curtis Rueden
    @ctrueden
    I was trying to whip up some code in Jupyter... but it takes a while.
    Hadrien Mary
    @hadim
    Ideally we need a Jupyterlab/Notebook extension that get the image data from the kernel and display them with a nice JS widget.
    Kyle I S Harrington
    @kephale
    ^^^ seconded. that display code includes some dependencies that hopefully will get factored out of SJJK
    Curtis Rueden
    @ctrueden
    Argh mime types. I wrote some code that lets you pass your own LUTs, but it just ends up dumping base64-encoded data as a string. I tried leaving off that step and just returning the BufferedImage directly, but that also doesn't work
    #@ OpService ops
    
    import net.imglib2.converter.RealLUTConverter
    import net.imglib2.display.projector.composite.CompositeXYProjector
    import net.imglib2.display.screenimage.awt.ARGBScreenImage
    import net.imagej.notebook.ImageJNotebookService.ValueScaling
    import org.scijava.notebook.converter.NotebookConverters
    
    display = { source, luts, xAxis, yAxis, cAxis, scaling, pos ->
        image = ops.transform().zeroMinView(source)
    
        w = xAxis >= 0 ? (int) image.dimension(xAxis) : 1
        h = yAxis >= 0 ? (int) image.dimension(yAxis) : 1
        c = cAxis >= 0 ? (int) image.dimension(cAxis) : 1
        target = new ARGBScreenImage(w, h)
        converters = []
    
        full = scaling == ValueScaling.FULL ||
            scaling == ValueScaling.AUTO && isNarrowType(source);
    
        if (full) {
            // scale the intensities based on the full range of the type
            min = image.firstElement().getMinValue()
            max = image.firstElement().getMaxValue()
        } else {
            // scale the intensities based on the sample values
            ii = ops.transform().flatIterableView(source)
            minMax = ops.stats().minMax(ii)
            min = minMax.getA().getRealDouble()
            max = minMax.getB().getRealDouble()
        }
    
        for (int i = 0; i < c; i++) {
            converters.add(new RealLUTConverter(min, max, luts[i]))
        }
        proj = new CompositeXYProjector(image, target, converters, cAxis);
        if (pos != null && pos.length > 0) proj.setPosition(pos)
        proj.setComposite(true)
        proj.map()
    
        // Convert to PNG
        return NotebookConverters.toPNG(target.image())
    }
    
    import net.imglib2.img.array.ArrayImgs
    import net.imagej.display.ColorTables
    
    w = 256; h = 192
    bytes = new byte[w * h]
    for (y=0; y<h; y++) {
        for (x=0; x<w; x++) {
            bytes[y * w + x] = (x + y) & 0xff
        }
    }
    source = ArrayImgs.unsignedBytes(bytes, w, h, 1)
    luts = [ ColorTables.FIRE ]
    
    display(source, luts, 0, 1, 2, ValueScaling.FULL, [] as long[])
    The right thing to do is probably for ImageJNotebookService.display(Dataset) to extract the LUTs and pass those to a new RAIToPNG that accepts the LUTs. But we have to be careful with LUT indices. They correspond to Dataset plane indices which are nontrivial to reason about.
    I really need to work on SJC now, so I'll leave it there.
    Jan Eglinger
    @imagejan
    Thanks a lot, @ctrueden, that’s already of great help!
    matrixbot
    @matrixbot
    superusercode test
    superusercode Does ImageJ have an official IRC channel?
    Niko Ehrenfeuchter
    @ehrenfeu
    @matrixbot you kind of found it (although it's not IRC) - but note that this is primarily intended for developer's discussions, for help with using ImageJ the official ImageJ Forum is a much better location...
    If you're desperate for IRC you could try https://irc.gitter.im/ but note that it's officially beta
    matrixbot
    @matrixbot
    superusercode I'll just continue accessing through matrix then
    Jan Eglinger
    @imagejan
    ImageJ Logo.gif
    How about a new splash screen animation?
    Gabriel Einsdorf
    @gab1one
    oh cool
    Max Leiter
    @MaxLeiter
    ehrenfeu: fitter has an IRC gateway
    gitter*
    I use it and it works quite well
    Max Leiter
    @MaxLeiter
    oh, just saw ehrenfeu mentioned it