Skip to content

Commit 87db20a

Browse files
author
cxallan
committed
Large overhaul for Plate name and description manipulation via ImportCandidates configuration (Fixes #2648)
* ImportContainer is now much more flexible and as of 4.2.1 will be the primary way to configure an import * Deprecated old importImage() methods * Added --plate_name and --plate_description to the command line options * Removed un-used FileInfo interactions with the ImportContainer * ImportCandidates is now much more through in populating ImportContainer fields * Cleaned up extra System.err.println of logging levels in command line importer git-svn-id: file:///home/svn/omero/trunk@8169 05709c45-44f0-0310-885b-81a1db45b4a6
1 parent 6ef343f commit 87db20a

8 files changed

+366
-114
lines changed

components/tools/OmeroImporter/src/ome/formats/OMEROMetadataStoreClient.java

+59-5
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,19 @@ public class OMEROMetadataStoreClient
276276

277277
/** Annotations from the user for use by model processors. */
278278
private List<Annotation> userSpecifiedAnnotations;
279-
279+
280280
/** Image name the user specified for use by model processors. */
281281
private String userSpecifiedImageName;
282-
282+
283283
/** Image description the user specified for use by model processors. */
284284
private String userSpecifiedImageDescription;
285-
285+
286+
/** Plate name the user specified for use by model processors. */
287+
private String userSpecifiedPlateName;
288+
289+
/** Plate description the user specified for use by model processors. */
290+
private String userSpecifiedPlateDescription;
291+
286292
/** Linkage target for all Images/Plates for use by model processors. */
287293
private IObject userSpecifiedTarget;
288294

@@ -1024,7 +1030,47 @@ public void setUserSpecifiedAnnotations(List<Annotation> annotations)
10241030
{
10251031
this.userSpecifiedAnnotations = annotations;
10261032
}
1027-
1033+
1034+
/* (non-Javadoc)
1035+
* @see ome.formats.model.IObjectContainerStore#getUserSpecifiedPlateName()
1036+
*/
1037+
public String getUserSpecifiedPlateName()
1038+
{
1039+
return userSpecifiedPlateName;
1040+
}
1041+
1042+
/* (non-Javadoc)
1043+
* @see ome.formats.model.IObjectContainerStore#setUserSpecifiedPlateName(java.lang.String)
1044+
*/
1045+
public void setUserSpecifiedPlateName(String name)
1046+
{
1047+
if (log.isDebugEnabled())
1048+
{
1049+
log.debug("Using user specified plate name: " + name);
1050+
}
1051+
userSpecifiedPlateName = name;
1052+
}
1053+
1054+
/* (non-Javadoc)
1055+
* @see ome.formats.model.IObjectContainerStore#getUserSpecifiedPlateDescription()
1056+
*/
1057+
public String getUserSpecifiedPlateDescription()
1058+
{
1059+
return userSpecifiedPlateDescription;
1060+
}
1061+
1062+
/* (non-Javadoc)
1063+
* @see ome.formats.model.IObjectContainerStore#setUserSpecifiedPlateDescription(java.lang.String)
1064+
*/
1065+
public void setUserSpecifiedPlateDescription(String description)
1066+
{
1067+
if (log.isDebugEnabled())
1068+
{
1069+
log.debug("Using user specified plate description: " + description);
1070+
}
1071+
userSpecifiedPlateDescription = description;
1072+
}
1073+
10281074
/* (non-Javadoc)
10291075
* @see ome.formats.model.IObjectContainerStore#getUserSpecifiedImageName()
10301076
*/
@@ -1038,6 +1084,10 @@ public String getUserSpecifiedImageName()
10381084
*/
10391085
public void setUserSpecifiedImageName(String name)
10401086
{
1087+
if (log.isDebugEnabled())
1088+
{
1089+
log.debug("Using user specified image name: " + name);
1090+
}
10411091
this.userSpecifiedImageName = name;
10421092
}
10431093

@@ -1054,9 +1104,13 @@ public String getUserSpecifiedImageDescription()
10541104
*/
10551105
public void setUserSpecifiedImageDescription(String description)
10561106
{
1107+
if (log.isDebugEnabled())
1108+
{
1109+
log.debug("Using user specified image description: " + description);
1110+
}
10571111
this.userSpecifiedImageDescription = description;
10581112
}
1059-
1113+
10601114
/* (non-Javadoc)
10611115
* @see ome.formats.model.IObjectContainerStore#getUserSpecifiedTarget()
10621116
*/

components/tools/OmeroImporter/src/ome/formats/importer/ImportCandidates.java

+6
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,13 @@ protected ImportContainer singleFile(File file, ImportConfig config)
414414
ic.setBfImageCount(reader.getSeriesCount());
415415
ic.setBfPixels(getPixelsWithDimensions());
416416
ic.setBfImageNames(getImageNames());
417+
ic.setCustomImageName(config.imageName.get());
418+
ic.setCustomImageDescription(config.imageDescription.get());
419+
ic.setCustomPlateName(config.plateName.get());
420+
ic.setCustomPlateDescription(config.plateDescription.get());
417421
ic.setArchive(config.archiveImage.get());
422+
ic.setCustomAnnotationList(config.annotations.get());
423+
ic.setUseMetadataFile(config.companionFile.get());
418424
return ic;
419425
} finally
420426
{

components/tools/OmeroImporter/src/ome/formats/importer/ImportConfig.java

+36-16
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ public class ImportConfig {
106106
public final StrValue serverList;
107107
public final StrValue imageName;
108108
public final StrValue imageDescription;
109+
public final StrValue plateName;
110+
public final StrValue plateDescription;
109111
public final StrValue targetClass;
110112
public final LongValue targetId;
111113

@@ -123,10 +125,11 @@ public class ImportConfig {
123125

124126
public final FileValue savedDirectory;
125127
public final StrValue readersPath;
126-
128+
127129
public final BoolValue encryptedConnection;
128-
130+
129131
public final AnnotationListValue annotations;
132+
public final DoubleArrayValue userPixels;
130133

131134
/**
132135
* Static method for creating {@link Preferences} during construction if
@@ -211,6 +214,8 @@ public synchronized void load() {
211214
serverList = new StrValue("serverList", this);
212215
imageName = new StrValue("imageName", this);
213216
imageDescription = new StrValue("imageDescription", this);
217+
plateName = new StrValue("plateName", this);
218+
plateDescription = new StrValue("plateDescription", this);
214219
targetClass = new StrValue("targetClass", this);
215220
targetId = new LongValue("targetId", this, 0);
216221

@@ -230,11 +235,13 @@ public synchronized void load() {
230235
useCustomImageNaming = new BoolValue("overrideImageName", this, true);
231236
numOfDirectories = new IntValue("numOfDirectories", this, 0);
232237
savedDirectory = new FileValue("savedDirectory", this);
233-
238+
234239
encryptedConnection = new BoolValue("ecryptedConnection", this, true);
235-
240+
236241
annotations = new AnnotationListValue(
237-
"annotations", this, new ArrayList<Annotation>());
242+
"annotations", this, new ArrayList<Annotation>());
243+
userPixels = new DoubleArrayValue(
244+
"userPixels", this, null);
238245

239246
readersPath = new StrValue("readersPath", this);
240247
}
@@ -844,18 +851,31 @@ public boolean empty() {
844851
return s == null || s.length() == 0;
845852
}
846853
}
847-
854+
848855
public static class AnnotationListValue extends Value<List<Annotation>> {
849-
850-
public AnnotationListValue(String key, ImportConfig config,
851-
List<Annotation> defValue) {
852-
super(key, config, defValue);
853-
}
854-
855-
@Override
856-
protected List<Annotation> fromString(String string) {
857-
throw new RuntimeException("Not implemented.");
858-
}
856+
857+
public AnnotationListValue(String key, ImportConfig config,
858+
List<Annotation> defValue) {
859+
super(key, config, defValue);
860+
}
861+
862+
@Override
863+
protected List<Annotation> fromString(String string) {
864+
throw new RuntimeException("Not implemented.");
865+
}
866+
}
867+
868+
public static class DoubleArrayValue extends Value<Double[]> {
869+
870+
public DoubleArrayValue(String key, ImportConfig config,
871+
Double[] defValue) {
872+
super(key, config, defValue);
873+
}
874+
875+
@Override
876+
protected Double[] fromString(String string) {
877+
throw new RuntimeException("Not implemented.");
878+
}
859879
}
860880

861881
public static class PassValue extends StrValue {

0 commit comments

Comments
 (0)