@Override public Dimensions getImageSize(int timepointId) { return wrappedImgLoader.getSetupImgLoader( setupId ).getImageSize( timepointId ); }
@Override public T getImageType() { @SuppressWarnings("unchecked") T res = (T) wrappedImgLoader.getSetupImgLoader( setupId ).getImageType(); return res; }
@Override public double[][] getMipmapResolutions() { return wrappedImgLoader.getSetupImgLoader( setupId ).getMipmapResolutions(); }
return wrpSetupIL.getFloatImage( timepointId, level, normalize, hints ); final int n = wrpSetupIL.getImageSize( timepointId ).numDimensions(); final double[] dsD = wrpSetupIL.getMipmapResolutions()[level]; for ( int d = 0; d < n; d++ ) (RandomAccessibleInterval< T >) wrpSetupIL.getImage( timepointId, level, hints ), getOrCreateBrightImgDownsampled( new ViewId( timepointId, setupId ), dsFactors ), getOrCreateDarkImgDownsampled( new ViewId( timepointId, setupId ), dsFactors ), new FloatType() );
public static RandomAccessibleInterval< FloatType > openAtLowestLevelFloat( final ImgLoader imgLoader, final ViewId view, final AffineTransform3D t ) { final RandomAccessibleInterval< FloatType > input; if ( MultiResolutionImgLoader.class.isInstance( imgLoader ) ) { final MultiResolutionImgLoader mrImgLoader = ( MultiResolutionImgLoader ) imgLoader; final double[][] mipmapResolutions = mrImgLoader.getSetupImgLoader( view.getViewSetupId() ).getMipmapResolutions(); final int bestLevel = findLowestResolutionLevel( mrImgLoader, view ); IOFunctions.println( "(" + new Date(System.currentTimeMillis()) + "): Loading level " + Util.printCoordinates( mipmapResolutions[ bestLevel ] ) ); input = mrImgLoader.getSetupImgLoader( view.getViewSetupId() ).getFloatImage( view.getTimePointId(), bestLevel, false ); if ( t != null ) t.set( mrImgLoader.getSetupImgLoader( view.getViewSetupId() ).getMipmapTransforms()[ bestLevel ] ); } else { IOFunctions.println( "(" + new Date(System.currentTimeMillis()) + "): Loading full-resolution images :( " ); input = imgLoader.getSetupImgLoader( view.getViewSetupId() ).getFloatImage( view.getTimePointId(), false ); if ( t != null ) t.identity(); } return input; }
public static RandomAccessibleInterval openAtLowestLevel( final ImgLoader imgLoader, final ViewId view, final AffineTransform3D t ) { final RandomAccessibleInterval input; if ( MultiResolutionImgLoader.class.isInstance( imgLoader ) ) { final MultiResolutionImgLoader mrImgLoader = ( MultiResolutionImgLoader ) imgLoader; final double[][] mipmapResolutions = mrImgLoader.getSetupImgLoader( view.getViewSetupId() ).getMipmapResolutions(); final int bestLevel = findLowestResolutionLevel( mrImgLoader, view ); IOFunctions.println( "(" + new Date(System.currentTimeMillis()) + "): Loading level " + Util.printCoordinates( mipmapResolutions[ bestLevel ] ) ); input = mrImgLoader.getSetupImgLoader( view.getViewSetupId() ).getImage( view.getTimePointId(), bestLevel ); if ( t != null ) t.set( mrImgLoader.getSetupImgLoader( view.getViewSetupId() ).getMipmapTransforms()[ bestLevel ] ); } else { IOFunctions.println( "(" + new Date(System.currentTimeMillis()) + "): Loading full-resolution images :( " ); input = imgLoader.getSetupImgLoader( view.getViewSetupId() ).getImage( view.getTimePointId() ); if ( t != null ) t.identity(); } return input; }
return (RandomAccessibleInterval< T >) wrpSetupIL.getImage( timepointId, level, hints ); final int n = wrpSetupIL.getImageSize( timepointId ).numDimensions(); final double[] dsD = wrpSetupIL.getMipmapResolutions()[level]; for ( int d = 0; d < n; d++ ) (RandomAccessibleInterval< T >) wrpSetupIL.getImage( timepointId, level, hints ), getOrCreateBrightImgDownsampled( new ViewId( timepointId, setupId ), dsFactors ), getOrCreateDarkImgDownsampled( new ViewId( timepointId, setupId ), dsFactors ) );
@Override public VoxelDimensions getVoxelSize(int timepointId) { return wrappedImgLoader.getSetupImgLoader( setupId ).getVoxelSize( timepointId ); }
@Override public AffineTransform3D[] getMipmapTransforms() { return wrappedImgLoader.getSetupImgLoader( setupId ).getMipmapTransforms(); }
@Override public int numMipmapLevels() { return wrappedImgLoader.getSetupImgLoader( setupId ).numMipmapLevels(); }
public static void main(String[] args) { GenericLoadParseQueryXML< SpimData2, SequenceDescription, ViewSetup, ViewDescription, ImgLoader, XmlIoSpimData2 > lpq = new GenericLoadParseQueryXML<>( new XmlIoSpimData2( "" ) ); lpq.queryXML(); SpimData2 data = lpq.getData(); // this will crash if il is not multires MultiResolutionImgLoader il = (MultiResolutionImgLoader) data.getSequenceDescription().getImgLoader(); MultiResolutionFlatfieldCorrectionWrappedImgLoader ffcil = new MultiResolutionFlatfieldCorrectionWrappedImgLoader( il ); ffcil.setDarkImage( new ViewId( 0, 0 ), new File( "/Users/david/desktop/ff.tif" ) ); data.getSequenceDescription().setImgLoader( ffcil ); new ImageJ(); RandomAccessibleInterval< FloatType > image = ( (MultiResolutionImgLoader) data.getSequenceDescription() .getImgLoader() ).getSetupImgLoader( 0 ).getFloatImage( 0, 1, false ); ImageJFunctions.show( image ); }
double[][] mipmapResolutions = mrImgLoader.getSetupImgLoader( vd.getViewSetupId() ).getMipmapResolutions(); final int fz = (int)Math.round( mipmapResolutions[ bestLevel ][ 2 ] ); mipMapTransform.set( mrImgLoader.getSetupImgLoader( vd.getViewSetupId() ).getMipmapTransforms()[ bestLevel ] ); input = mrImgLoader.getSetupImgLoader( vd.getViewSetupId() ).getFloatImage( vd.getTimePointId(), bestLevel, false, LOAD_COMPLETELY ); else input = mrImgLoader.getSetupImgLoader( vd.getViewSetupId() ).getFloatImage( vd.getTimePointId(), bestLevel, false );
final double[][] mipmapResolutions = mrImgLoader.getSetupImgLoader( viewId.getViewSetupId() ).getMipmapResolutions(); m.concatenate( mrImgLoader.getSetupImgLoader( viewId.getViewSetupId() ).getMipmapTransforms()[ bestLevel ] ); usedDownsampleFactors[ d ] = mipmapResolutions[ bestLevel ][ d ]; return mrImgLoader.getSetupImgLoader( viewId.getViewSetupId() ).getImage( viewId.getTimePointId(), bestLevel );
public static int findLowestResolutionLevel( final MultiResolutionImgLoader mrImgLoader, final ViewId view ) { final double[][] mipmapResolutions = mrImgLoader.getSetupImgLoader( view.getViewSetupId() ).getMipmapResolutions(); int maxMul = Integer.MIN_VALUE; int bestLevel = -1; for ( int i = 0; i < mipmapResolutions.length; ++i ) { int mul = 1; for ( int d = 0; d < mipmapResolutions[ i ].length; ++d ) mul *= mipmapResolutions[ i ][ d ]; if ( mul > maxMul ) { maxMul = mul; bestLevel = i; } } return bestLevel; }
@Override public Dimensions getImageSize(int timepointId, int level) { return wrappedImgLoader.getSetupImgLoader( setupId ).getImageSize( timepointId, level ); }
public static String[] availableDownsamplings( final AbstractSpimData< ? > data, final ViewId viewId ) { final String[] dsStrings; if (MultiResolutionImgLoader.class.isInstance( data.getSequenceDescription().getImgLoader() )) { final MultiResolutionImgLoader mrImgLoader = (MultiResolutionImgLoader) data.getSequenceDescription().getImgLoader(); final double[][] mipmapResolutions = mrImgLoader.getSetupImgLoader( viewId.getViewSetupId()).getMipmapResolutions(); dsStrings = new String[mipmapResolutions.length]; for (int i = 0; i<mipmapResolutions.length; i++) { final String fx = ((Long)Math.round( mipmapResolutions[i][0] )).toString(); final String fy = ((Long)Math.round( mipmapResolutions[i][1] )).toString(); final String fz = ((Long)Math.round( mipmapResolutions[i][2] )).toString(); final String dsString = String.join( ", ", fx, fy, fz ); dsStrings[i] = dsString; } } else { dsStrings = new String[]{ "1, 1, 1" }; } return dsStrings; }