Problem Ilastik macro "a dataset set is required but none exist"

Hello,

I’ve got a problem when i use Ilastik from FIJI into a batch processing macro.
I use this macro:

/ set global variables
pixelClassificationProject = "F:/Ilastik/Coralie/Seg_V2.ilp";
outputType = "Probabilities";
inputDataset = "data";
outputDataset = "exported_data";
axisOrder = "tzyxc";
compressionLevel = 0;

// process all H5 files in a given directory
dataDir = "F:/Ilastik/Coralie/Test/";
fileList = getFileList(dataDir);
for (i = 0; i < fileList.length; i++) {
	// import image from the H5
	fileName = dataDir + fileList[i];	
	importArgs = "select=" + fileName + " datasetname=" + inputDataset + " axisorder=" + axisOrder; 			
	run("Import HDF5", importArgs);

	// run pixel classification
	inputImage = fileName + "/" + inputDataset;
	pixelClassificationArgs = "projectfilename=" + pixelClassificationProject + " saveonly=false inputimage=" + inputImage + " chosenoutputtype=" + outputType;
	run("Run Pixel Classification Prediction", pixelClassificationArgs);

	// export probability maps to H5
	outputFile = dataDir + "output" + i + ".h5";
	exportArgs = "select=" + outputFile + " datasetname=" + outputDataset + " compressionlevel=" + compressionLevel;
	run("Export HDF5", exportArgs);
}

When i run it. I’ve got a window with this message “a dataset is required but none exist”
I use .h5 file and i can open them when i use import h5 file. So i don’t know why it’s doesn’t work.
I’ve got this message in the log:

[Wed Oct 23 16:42:37 CEST 2019] [INFO] /data: DATASET
[Wed Oct 23 16:42:37 CEST 2019] [ERROR] Module threw exception
java.lang.NullPointerException
at org.ilastik.ilastik4ij.IlastikImport.run(IlastikImport.java:64)
at org.scijava.command.CommandModule.run(CommandModule.java:199)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Have a nice day

Romain

Maybe @wolny can help?

Hi @RomainM,

this error (‘a dataset is required but none exist’) will pop up only if the h5 file does not have any datasets inside. Two things you might want to check:

  1. does “F:/Ilastik/Coralie/Test/” dir contain only h5 files?
  2. does each and every h5 file has the ‘data’ dataset inside?

Also the exception you got indicates that ‘data’ dataset in not present in one of your h5 files.

Hope this helps.

Best,
Adrian

1 Like

I reconvert my files with “export h5” and now it’s works!

Thx for the help!

Romain