Skip to content

Commit

Permalink
Reduce number of fields in memo file
Browse files Browse the repository at this point in the history
  • Loading branch information
dgault committed Feb 8, 2024
1 parent 401c999 commit 153a466
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/loci/formats/in/ZarrReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,18 @@ public class ZarrReader extends FormatReader {
public static final boolean INCLUDE_LABELS_DEFAULT = false;
protected transient ZarrService zarrService;
private ArrayList<String> arrayPaths = new ArrayList<String>();
private ArrayList<String> groupKeys = new ArrayList<String>();
private HashMap<Integer, ArrayList<String>> resSeries = new HashMap<Integer, ArrayList<String>>();
private HashMap<String, Integer> resCounts = new HashMap<String, Integer>();
private HashSet<Integer> uniqueResCounts = new HashSet<Integer>();
private HashMap<String, Integer> resIndexes = new HashMap<String, Integer>();

// The below fields are only required for initialization and are not required to be serialized
private transient ArrayList<String> groupKeys = new ArrayList<String>();
private transient HashMap<Integer, ArrayList<String>> resSeries = new HashMap<Integer, ArrayList<String>>(); // can be removed
private transient HashMap<String, Integer> resCounts = new HashMap<String, Integer>(); // can be removed
private transient HashSet<Integer> uniqueResCounts = new HashSet<Integer>(); // can be removed
private transient HashMap<String, Integer> resIndexes = new HashMap<String, Integer>(); // can be removed
private transient HashMap<String, ArrayList<String>> pathArrayDimensions = new HashMap<String, ArrayList<String>>(); // can be removed

private String dimensionOrder = "XYZCT";
private int wellCount = 0;
private int wellSamplesCount = 0;
private HashMap<String, ArrayList<String>> pathArrayDimensions = new HashMap<String, ArrayList<String>>();
private boolean planesPrePopulated = false;
private boolean hasSPW = false;
private transient int currentOpenZarr = -1;
Expand Down Expand Up @@ -200,15 +203,17 @@ protected void initFile(String id) throws FormatException, IOException {
if (attr != null && !attr.isEmpty()) {
parseResolutionCount(zarrRootPath, "", attr);
parseOmeroMetadata(zarrRootPath, attr);
String jsonAttr;
try {
jsonAttr = ZarrUtils.toJson(attr, true);
store.setXMLAnnotationValue(jsonAttr, attrIndex);
String xml_id = MetadataTools.createLSID("Annotation", attrIndex);
store.setXMLAnnotationID(xml_id, attrIndex);
} catch (JZarrException e) {
LOGGER.warn("Failed to convert attributes to JSON");
e.printStackTrace();
if (saveAnnotations()) {
String jsonAttr;
try {
jsonAttr = ZarrUtils.toJson(attr, true);
store.setXMLAnnotationValue(jsonAttr, attrIndex);
String xml_id = MetadataTools.createLSID("Annotation", attrIndex);
store.setXMLAnnotationID(xml_id, attrIndex);
} catch (JZarrException e) {
LOGGER.warn("Failed to convert attributes to JSON");
e.printStackTrace();
}
}
}
generateGroupKeys(attr, canonicalPath);
Expand Down

0 comments on commit 153a466

Please sign in to comment.