Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jean-Yves Tinevez
    @tinevez
    :plus1:
    Curtis Rueden
    @ctrueden
    @tinevez There is also API for it.
    For Bio-Formats:
    from loci.formats import ImageReader
    r = ImageReader()
    allowOpen = True
    isImageFile = r.isThisType("/home/curtis/data/blobs.tif.xls", allowOpen)
    print(isImageFile)
    For ImageJ2/SciJava:
    #@ IOService io
    #@ DatasetIOService dio
    print(io.getOpener("/home/curtis/data/blobs.tif.xls")) # plugin:org.scijava.text.io.TextIOPlugin
    print(io.getOpener("/home/curtis/data/blobs.tif")) # plugin:io.scif.io.DatasetIOPlugin
    print(dio.canOpen("/home/curtis/data/blobs.tif.xls")) # False
    print(dio.canOpen("/home/curtis/data/blobs.tif")) # True
    Christian Tischer
    @tischi
    Could be worth comparing the performances. I am afraid that the Bio-Formats virtual option that I suggested would still parse all the metadata in the file, which could take loooong for some file formats, like .czi
    Maybe @ctrueden suggestions are more performant?!
    Curtis Rueden
    @ctrueden
    My suggestions should not cause metadata to be parsed. They use the "checker" layer only.
    The most performant is with allowOpen=False, but then you might be false positives or negatives, depending on the file extension.
    Christian Tischer
    @tischi
    :thumbsup:
    Jean-Yves Tinevez
    @tinevez
    :plus1:
    odinsbane
    @odinsbane
    Is there an easy way to adjust the log level with bioformats? I'm using some scripts java -cp bioformats.jar:ij.jar MyScript.java and the log level is set on debug, which produces a crazy amount of information when I just want to open a virtual stack.
    14 replies
    Tayyaba Rabnawaz
    @TayyabaRabnawaz_gitlab
    Hi, I have alot of images with different name (ab1,abc,bf2...)and I want to rename them in numeric sequence like 1,2,3... How I can do this
    habi
    @habi:matrix.org
    [m]
    I would load the images in a stack and write them out in a new stack.
    (If it has to happen in ImageJ, otherwise I'd do this on the Operating System level).
    Tayyaba Rabnawaz
    @TayyabaRabnawaz_gitlab
    Thank you
    Gabriel Selzer
    @gselzer
    What's the best way to get an ImageDisplay from a RAI? new DefaultImageDisplay() then display(<my rai>)?
    Is there a Converter to do this? If not, is there a reason why?
    Jan Eglinger
    @imagejan
    hm, DisplayService#createDisplay(RAI)?
    Gabriel Selzer
    @gselzer
    Oh, how did I miss that? Thanks @imagejan.
    Still, I'm surprised there's no Converter for it...
    1 reply
    Edward Evans
    @elevans

    @ctrueden I'm working on some of those low hanger fruit image conversion functions in imagej-common. When I run mvn the ImgLabelingConversionTest test incorrectly grabs the RAIToDatasetConverter.class we wrote instead of ImgLabelingToImgConverter.

    Here's the output:

    [INFO] Results:
    [INFO] 
    [ERROR] Failures: 
    [ERROR]   ImgLabelingConversionTest.testImgLabelingToImgConversion:81 expected:<class net.imagej.convert.ImgLabelingToImgConverter> but was:<class net.imagej.convert.RAIToDatasetConverter>
    [ERROR] Errors: 
    [ERROR]   ImgLabelingConversionTest.testTwoWayConversion:92 ยป IllegalArgument Only RealT...
    [INFO] 
    [ERROR] Tests run: 293, Failures: 1, Errors: 1, Skipped: 0

    Here is the line that fails in the test

    assertEquals(ImgLabelingToImgConverter.class, convertService.getHandler(labeling, Img.class).getClass());

    I'm guessing convertService.getHandler() is returning the wrong class because the RAIToDatasetConverter is vague enough that ImgLabeling is caught. Its not obvious to me...how do I limit the scope to avoid this?

    Curtis Rueden
    @ctrueden
    @elevans Heh, yeah, that's a funny problem! I guess ImgLabeling implements RandomAccessibleInterval, no?
    Edward Evans
    @elevans
    haha yes it does
    Curtis Rueden
    @ctrueden
    And of course, Dataset implements Img... so if you have an ImgLabeling, to the system, it looks like that converter will be able to turn it into a Dataset, which is an Img, so... it gets selected! :+1:
    But really, the RAIToDatasetConverter doesn't work unless the RAI in question has RealType samples.
    So, we'll need to add some additional constraint to check for that, I think.
    Edward Evans
    @elevans
    Cool! makes sense :)
    Curtis Rueden
    @ctrueden
    Unfortunately, the Converter plugin framework does not support generic typing. And doing so would complexify it a lot.
    For this reason, IIRC, we deprecated the functions that ask "can I convert from Class X to Class Y?" because, just from the class, you might not actually be able to answer the question.
    We need an actual instance of the class in order to check it.
    But... some places deep in the framework might still use the deprecated "Class X to Class Y" methods.
    So, potential for bugs here is higher.
    Edward Evans
    @elevans
    This fruit is starting to seem a little higher on the tree haha
    Curtis Rueden
    @ctrueden
    Nah, fortunately, you can at least try to fix it quickly for this one, because the method you implemented is convert(Object, Class), right, so you can check the object in there whether it has a supported sample type.
    The only tricky bit is that I guess we need to also override some supports or canConvert method.
    Edward Evans
    @elevans
    yeah i saw some of the other converts use canConvert
    I'll use one of them as a guide and override the supports & canConvert method.
    Curtis Rueden
    @ctrueden
    Try adding this:
        @Override
        public boolean canConvert(final Object src, final Type dest) {
            if (!hasCompatibleType(src)) return false;
            return super.canConvert(src, dest);
        }
    
        @Override
        public boolean canConvert(final Object src, final Class<?> dest) {
            if (!hasCompatibleType(src)) return false;
            return super.canConvert(src, dest);
        }
    And then you'll have to implement hasCompatibleType(Object). net.imglib2.util.Util.getTypeFromInterval((RandomAccessibleInterval) src) is your friend here.
    Edward Evans
    @elevans
    :thumbsup:
    Curtis Rueden
    @ctrueden
    Oh, hey, there is one other thing you can do here, which is easy: you can set a priority to Priority.LOW in the @Plugin annotation, for the plugin you want to be less aggressive.
    Gabriel Selzer
    @gselzer
    Heh, maybe we can annotate the converters as Ops in SJ3. Then you could choose whether you want that type reasoning
    Curtis Rueden
    @ctrueden
    • Today I got net.imagej:ij:1.53k through net.imagej:ij:1.53p deployed to OSS Sonatype. Yay!
    • The ImageJ project also has a README on GitHub now, a POM file for building with Maven, unit tests (though some of them do not currently pass), and Ant targets for running those tests. The ImageJ repository on GitHub also now has tags for all the old versions back to v1.20.
    • The GitHub Actions CI now builds ImageJ at version 1.x-SNAPSHOT whenever it changes, which is always accessible from maven.scijava.org and should be equivalent to the latest daily build.
    • Tomorrow, I will finish teaching the CI to deploy release versions of net.imagej:ij to OSS Sonatype automatically, so it doesn't fall behind again.
    Niko Ehrenfeuchter
    @ehrenfeu
    :heart: :clap:
    dfperrault
    @dfperrault
    I am having problems installing Image/Fiji on my raspberry pi. Does anyone have any experience?
    1 reply
    Gabriel Selzer
    @gselzer
    @dfperrault that would be a good question to ask on forum.image.sc (if it hasn't been asked already :sweat_smile:)
    A quick search for 'raspberry pi' shows many different results
    dfperrault
    @dfperrault
    Thanks!
    Gabriel Selzer
    @gselzer
    :+1: