kreshuklab / plant-seg

A tool for cell instance aware segmentation in densely packed 3D volumetric images
https://kreshuklab.github.io/plant-seg/
MIT License
89 stars 31 forks source link

PlantSeg v2 I/O Utility's `VoxelSize` only allows `µm` #288

Open qin-yu opened 1 month ago

qin-yu commented 1 month ago
qin-yu commented 1 month ago

I checked ImageJ's implementation in Java, and believe it could work if we only check for startwith: µ, u, micro

https://github.com/imagej/ImageJ/blob/7746fcb0f5744a7a7758244c5dcd2193459e6e0e/ij/plugin/filter/ImageProperties.java#L255-L277

    static int getUnitIndex(String unit) {
        unit = unit.toLowerCase(Locale.US);
        if (unit.equals("cm")||unit.startsWith("cent"))
            return CENTIMETER;
        else if (unit.equals("mm")||unit.startsWith("milli"))
            return MILLIMETER;
        else if (unit.startsWith("inch"))
            return INCH;
        else if (unit.startsWith(""+IJ.micronSymbol)||unit.startsWith("u")||unit.startsWith("micro"))
            return MICROMETER;
        else if (unit.equals("nm")||unit.startsWith("nano"))
            return NANOMETER;
        else if (unit.equals("m") || unit.startsWith("meter"))
            return METER;
        else if (unit.equals("km")||unit.startsWith("kilo"))
            return KILOMETER;
        else if (unit.equals("ft")||unit.equals("foot")||unit.equals("feet"))
            return FOOT;
        else if (unit.equals("mi")||unit.startsWith("mile"))
            return MILE;
        else
            return OTHER_UNIT;
    }