8000 Unable to use CellImg as input for some algorithms · Issue #59 · imglib/imglib2-algorithm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unable to use CellImg as input for some algorithms #59
Closed
@MyleneSimon

Description

@MyleneSimon

Hi,

I am trying to write some simple code to try out imglib2, basically opening an image, process it using one of the algorithms and save it.
When I want to open the image as a CellImg, I then get the following error when I call one of the Gauss or Thresholder for example:

Exception in thread "main" java.lang.IllegalStateException: Tried to create a new SCIFIOCellImg without a Reader to use for opening planes.
Call setReader(Reader) before invoking create()
	at io.scif.img.cell.SCIFIOCellImgFactory.create(SCIFIOCellImgFactory.java:159)
	at io.scif.img.cell.SCIFIOCellImgFactory.create(SCIFIOCellImgFactory.java:71)
	at net.imglib2.img.ImgFactory.create(ImgFactory.java:74)
	at net.imglib2.algorithm.gauss.AbstractGauss.<init>(AbstractGauss.java:110)
	at net.imglib2.algorithm.gauss.GaussFloat.<init>(GaussFloat.java:110)
	at net.imglib2.algorithm.gauss.Gauss.inFloatInPlace(Gauss.java:313)
	at net.imglib2.algorithm.gauss.Gauss.inFloatInPlace(Gauss.java:271)
	at net.imglib2.algorithm.gauss.Gauss.inFloatInPlace(Gauss.java:256)

Here is the code producing the error:

File file = new File( "/path/to/input/DrosophilaWing.tif" );  
String path = file.getAbsolutePath();

File fileO = new File( "/path/to/output/DrosophilaWing.tif" );
			
SCIFIOConfig config = new SCIFIOConfig();
config.imgOpenerSetImgModes( ImgMode.CELL );
			
ImgOpener imgOpener = new ImgOpener();

System.out.println("Opening input image");
final Img< T > image = (Img<T>) imgOpener.openImg( path, config );
			
System.out.println(image.factory().getClass());

System.out.println("Convolve image");
Gauss.inFloatInPlace( 2, image);
			
System.out.println("Save image");
ImgSaver imgSaver = new ImgSaver();
imgSaver.saveImg(fileO.getAbsolutePath(), image);

Am I missing something? If I don't put the SCIFIOConfig when opening the image, it is opened as an ArrayImg and I don't get any error.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0