diff --git a/components/blitz/src/ome/formats/importer/ImportCandidates.java b/components/blitz/src/ome/formats/importer/ImportCandidates.java index b326aeda38c..b0da382dd9f 100644 --- a/components/blitz/src/ome/formats/importer/ImportCandidates.java +++ b/components/blitz/src/ome/formats/importer/ImportCandidates.java @@ -437,14 +437,7 @@ protected ImportContainer singleFile(File file, ImportConfig config) ic.setDoThumbnails(config.doThumbnails.get()); ic.setNoStatsInfo(config.noStatsInfo.get()); String configImageName = config.userSpecifiedName.get(); - if (configImageName == null) - { - ic.setUserSpecifiedName(file.getName()); - } - else - { - ic.setUserSpecifiedName(configImageName); - } + ic.setUserSpecifiedName(configImageName); ic.setUserSpecifiedDescription(config.userSpecifiedDescription.get()); ic.setCustomAnnotationList(config.annotations.get()); return ic; diff --git a/components/blitz/src/ome/formats/importer/ImportFixture.java b/components/blitz/src/ome/formats/importer/ImportFixture.java index 78a09d52e30..a8fab2ba22c 100644 --- a/components/blitz/src/ome/formats/importer/ImportFixture.java +++ b/components/blitz/src/ome/formats/importer/ImportFixture.java @@ -112,7 +112,6 @@ public void doImport() throws Throwable { ic = new ImportContainer(file, fads.get(file), null, null, null, null); - ic.setUserSpecifiedName(file.getAbsolutePath()); library.importImage(ic, 0, 0, 1); /* library.importImage(file, 0, 0, 1, file.getAbsolutePath(), diff --git a/components/blitz/src/ome/formats/model/PixelsProcessor.java b/components/blitz/src/ome/formats/model/PixelsProcessor.java index c871263e458..8270fc74836 100644 --- a/components/blitz/src/ome/formats/model/PixelsProcessor.java +++ b/components/blitz/src/ome/formats/model/PixelsProcessor.java @@ -27,6 +27,7 @@ import static ome.formats.model.UnitsFactory.makeLength; +import java.io.File; import java.sql.Timestamp; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -131,6 +132,10 @@ public void process(IObjectContainerStore store) throws ModelException { userSpecifiedName = null; } } + if (userSpecifiedName == null) { + File originalFile = new File(reader.getCurrentFile()); + userSpecifiedName = originalFile.getName(); + } String saveName = ""; String imageName; if (image.getName() != null && image.getName().getValue() != null) { diff --git a/components/blitz/src/ome/formats/model/WellProcessor.java b/components/blitz/src/ome/formats/model/WellProcessor.java index 2d411744325..2c2494c8850 100644 --- a/components/blitz/src/ome/formats/model/WellProcessor.java +++ b/components/blitz/src/ome/formats/model/WellProcessor.java @@ -26,6 +26,7 @@ import static omero.rtypes.rint; import static omero.rtypes.rstring; +import java.io.File; import java.util.LinkedHashMap; import java.util.List; @@ -95,16 +96,22 @@ private Plate validatePlate(int plateIndex) { Plate plate = (Plate) container.sourceObject; String userSpecifiedPlateName = store.getUserSpecifiedName(); String userSpecifiedPlateDescription = store.getUserSpecifiedDescription(); + if (userSpecifiedPlateName != null) { plate.setName(rstring(userSpecifiedPlateName)); } + if (plate.getName() == null || plate.getName().getValue() == null || + plate.getName().getValue().isEmpty()) + { + log.warn("Missing plate name for: " + container.LSID); + String filename = store.getReader().getCurrentFile(); + filename = new File(filename).getName(); + plate.setName(rstring(filename)); + } + if (userSpecifiedPlateDescription != null) { plate.setDescription(rstring(userSpecifiedPlateDescription)); } - if (plate.getName() == null) { - log.warn("Missing plate name for: " + container.LSID); - plate.setName(rstring("Plate")); - } if (plate.getRows() == null) { plate.setRows(rint(1)); }