-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.embl.mobie.lib.hcs.omezarr; | ||
|
||
public class Column | ||
{ | ||
public String name; | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/org/embl/mobie/lib/hcs/omezarr/HCSMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.embl.mobie.lib.hcs.omezarr; | ||
|
||
public class HCSMetadata | ||
{ | ||
public Plate plate; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.embl.mobie.lib.hcs.omezarr; | ||
|
||
public class Image | ||
{ | ||
public String path; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.embl.mobie.lib.hcs.omezarr; | ||
|
||
import java.util.List; | ||
|
||
public class Plate | ||
{ | ||
public List< Column > columns; | ||
public int field_count; | ||
public String name; | ||
public List< Row > rows; | ||
public List< Well > wells; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.embl.mobie.lib.hcs.omezarr; | ||
|
||
public class Row | ||
{ | ||
public String name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.embl.mobie.lib.hcs.omezarr; | ||
|
||
import java.util.List; | ||
|
||
public class Well | ||
{ | ||
public String path; | ||
public List< Image > images; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/org/embl/mobie/lib/hcs/omezarr/WellMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.embl.mobie.lib.hcs.omezarr; | ||
|
||
import java.util.List; | ||
|
||
public class WellMetadata | ||
{ | ||
public Well well; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package develop; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.reflect.TypeToken; | ||
import org.embl.mobie.io.util.IOHelper; | ||
import org.embl.mobie.lib.hcs.omezarr.HCSMetadata; | ||
import org.embl.mobie.lib.hcs.omezarr.Well; | ||
import org.embl.mobie.lib.hcs.omezarr.WellMetadata; | ||
import org.embl.mobie.lib.serialize.JsonHelper; | ||
|
||
import java.io.IOException; | ||
import java.lang.reflect.Type; | ||
|
||
public class ParseOMEZarrHCSMetadata | ||
{ | ||
|
||
public static final String ZATTRS = "/.zattrs"; | ||
|
||
public static void main( String[] args ) throws IOException | ||
{ | ||
Gson gson = JsonHelper.buildGson(false); | ||
|
||
String url = "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.1/plates/5966.zarr"; | ||
final String plateJson = IOHelper.read( url + ZATTRS ); | ||
System.out.println( plateJson ); | ||
HCSMetadata hcsMetadata = gson.fromJson(plateJson, new TypeToken< HCSMetadata >() {}.getType()); | ||
String wellPath = hcsMetadata.plate.wells.get( 0 ).path; | ||
System.out.printf( "Site path: " + wellPath ); | ||
String wellURL = url + "/" + wellPath ; | ||
final String wellJson = IOHelper.read( wellURL + ZATTRS ); | ||
System.out.println( wellJson ); | ||
|
||
WellMetadata wellMetadata = gson.fromJson( wellJson, new TypeToken< WellMetadata >() {}.getType() ); | ||
String imagePath = wellMetadata.well.images.get( 0 ).path; | ||
String imageURL = url + "/" + wellPath + "/" + imagePath; | ||
final String imageJson = IOHelper.read( imageURL + ZATTRS ); | ||
System.out.println( imageJson ); | ||
} | ||
} |