Skip to content

Commit

Permalink
Implement DataStore.getSourceAndConverters( ( Collection ) images )
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Jun 19, 2024
1 parent 1ab1dbc commit fcc8db2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/main/java/org/embl/mobie/DataStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;

public abstract class DataStore
{
Expand All @@ -71,6 +72,13 @@ public abstract class DataStore
return sourceToImage;
}

public static List< SourceAndConverter< ? > > getSourceAndConverters( Collection< Image< ? > > images )
{
return Collections.unmodifiableList( images.stream()
.map( image -> sourceToImage().inverse().get( image ) )
.collect( Collectors.toList() ) );
}

public static ImageData< ? > fetchImageData(
String path,
ImageDataFormat imageDataFormat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.embl.mobie.lib.image.Image;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -81,9 +82,7 @@ public List< Image< T > > images()
@Override
public List< SourceAndConverter< T > > sourceAndConverters()
{
return Collections.unmodifiableList( ( List ) images.stream()
.map( image -> DataStore.sourceToImage().inverse().get( image ) )
.collect( Collectors.toList() ) );
return DataStore.getSourceAndConverters( ( Collection ) images );
}

public void setOpacity( double opacity )
Expand Down

0 comments on commit fcc8db2

Please sign in to comment.