Skip to content
Snippets Groups Projects
Commit 67e80117 authored by brinn's avatar brinn
Browse files

improve: in loadImages(), avoid calling openbis.listImageDatasets() and...

improve: in loadImages(), avoid calling openbis.listImageDatasets() and openbis.listImageMetadata() twice

SVN: 18232
parent 9360af89
No related branches found
No related tags found
No related merge requests found
...@@ -519,37 +519,24 @@ public class OpenBISScreeningML ...@@ -519,37 +519,24 @@ public class OpenBISScreeningML
{ {
throw new RuntimeException("No plate with that code found."); throw new RuntimeException("No plate with that code found.");
} }
final List<ImageDatasetReference> imageDatasets =
openbis.listImageDatasets(Arrays.asList(plateId));
final List<ImageDatasetMetadata> meta = openbis.listImageMetadata(imageDatasets);
if (meta.isEmpty())
{
return new Object[][][]
{ new Object[0][], new Object[0][] };
}
final List<String> imageChannels; final List<String> imageChannels;
if (channels == null || channels.length == 0) if (channels == null || channels.length == 0)
{ {
final List<ImageDatasetReference> imageDatasets =
openbis.listImageDatasets(Arrays.asList(plateId));
final List<ImageDatasetMetadata> meta = openbis.listImageMetadata(imageDatasets);
if (meta.isEmpty())
{
return new Object[][][]
{ new Object[0][], new Object[0][] };
}
imageChannels = getChannelCodes(meta); imageChannels = getChannelCodes(meta);
} else } else
{ {
imageChannels = Arrays.asList(channels); imageChannels = Arrays.asList(channels);
} }
final List<ImageDatasetReference> imageDatasets =
openbis.listImageDatasets(Arrays.asList(plateId));
if (imageDatasets.isEmpty())
{
return new Object[][][]
{ new Object[0][], new Object[0][] };
}
final List<PlateImageReference> imageReferences = final List<PlateImageReference> imageReferences =
new ArrayList<PlateImageReference>(imageDatasets.size()); new ArrayList<PlateImageReference>(imageDatasets.size());
final List<ImageDatasetMetadata> meta = openbis.listImageMetadata(imageDatasets);
if (meta.isEmpty())
{
return new Object[][][]
{ new Object[0][], new Object[0][] };
}
final List<File> imageFiles = final List<File> imageFiles =
new ArrayList<File>(imageDatasets.size() * imageChannels.size() new ArrayList<File>(imageDatasets.size() * imageChannels.size()
* meta.get(0).getNumberOfTiles()); * meta.get(0).getNumberOfTiles());
...@@ -625,7 +612,7 @@ public class OpenBISScreeningML ...@@ -625,7 +612,7 @@ public class OpenBISScreeningML
{ {
return imageRefToFileMap.get(imageReference); return imageRefToFileMap.get(imageReference);
} }
}); }, false);
} finally } finally
{ {
closeOutputStreams(imageRefToFileMap.values()); closeOutputStreams(imageRefToFileMap.values());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment