Open qin-yu opened 1 month ago
I checked ImageJ's implementation in Java, and believe it could work if we only check for startwith
: µ
, u
, micro
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;
}
Also, for µm, I now have images with
µm
,micrometer
, andmicron
, I guess we need:But now we only have
["um", "µm", "micrometers"]
.