open h5 files as image in KNIME


Is it possible to import ilastik generated probability maps (exported as .h5) files into KNIME? 

The KNIME image reader can not open such files whereas the KNIME file reader reads something but I didn't manage to somehow convert this into an image again (which I suppose should be possible somehow). 

If I export the probabilty maps in ilastik as multipage tif processing takes much longer plus KNIME doesn't read these files correctly either (it just opens the first slice of a z-stack but I guess this is a problem of ilastik). 

Using the ilastik integration doesn't really work for me that's why I try it this way.



Hi Christian,

we have something experimental on this front. I will take a look and see if I can get it to run. If not, I will file an issue for the Ilastik integration.

Can you quickly ellaborate why the Ilastik extension is not working for you? Maybe we can fix it?



Hi Christian

Thanks for your effort. When I use ilastik headless node in KNIME at the same image stack that I used for the training in ilastik (the image is saved to the ilastik project file, image is a three dimensional z-stack) the node executes forever and can't be cancelled similarly as reported recently here:

However it seems that I get a different type of error message. The ilastik log looks like this:

INFO 2016-11-18 10:42:52,269 ilastik_main 4648 964 Starting ilastik from "C:\Program Files\ilastik-1.2.0rc7".
INFO 2016-11-18 10:42:52,834 opThresholdTwoLevels 4648 964 Using 'vigra' labeling implemetation
WARNING 2016-11-18 10:42:52,898 opConservationTracking 4648 964 RuntimeWarning: to-Python converter for class std::vector<unsigned __int64,class std::allocator<unsigned __int64> > already registered; second conversion method ignored.
WARNING 2016-11-18 10:42:52,898 opConservationTracking 4648 964 RuntimeWarning: to-Python converter for class std::vector<double,class std::allocator<double> > already registered; second conversion method ignored.
INFO 2016-11-18 10:42:53,045 projectManager 4648 964 Opening Project: G:/Christian/2016/ilastik_templ/nuclei2.ilp
WARNING 2016-11-18 10:42:53,417 dataset 4648 964 DeprecationWarning: numpy boolean negative, the `-` operator, is deprecated, use the `~` operator or the logical_not function instead.
INFO 2016-11-18 10:42:53,568 pixelClassificationWorkflow 4648 964 Beginning Batch Processing
INFO 2016-11-18 10:42:53,924 batchProcessingApplet 4648 964 Exporting to C:/Users/jlabimaging/AppData/Local/Temp/ilastik/47bf6896-4534-4227-92a7-fd4ffe17332a/file0_result.tif
ERROR 2016-11-18 10:42:54,033 log_exception 4648 964 Traceback (most recent call last):
  File "C:\Program Files\ilastik-1.2.0rc7\ilastik-meta\ilastik\ilastik\shell\", line 443, in _loadProject
    self.workflow.onProjectLoaded( self )
  File "C:\Program Files\ilastik-1.2.0rc7\ilastik-meta\ilastik\ilastik\workflows\pixelClassification\", line 337, in onProjectLoaded
  File "C:\Program Files\ilastik-1.2.0rc7\ilastik-meta\ilastik\ilastik\applets\batchProcessing\", line 59, in run_export_from_parsed_args
    return self.run_export(role_path_dict, parsed_args.input_axes)
  File "C:\Program Files\ilastik-1.2.0rc7\ilastik-meta\ilastik\ilastik\applets\batchProcessing\", line 120, in run_export
    export_to_array=export_to_array )
  File "C:\Program Files\ilastik-1.2.0rc7\ilastik-meta\ilastik\ilastik\applets\batchProcessing\", line 232, in _run_export_with_empty_batch_lane
  File "C:\Program Files\ilastik-1.2.0rc7\ilastik-meta\ilastik\ilastik\applets\dataExport\", line 265, in run_export
  File "C:\Program Files\ilastik-1.2.0rc7\ilastik-meta\lazyflow\lazyflow\operators\ioOperators\", line 233, in run_export
  File "C:\Program Files\ilastik-1.2.0rc7\ilastik-meta\lazyflow\lazyflow\operators\ioOperators\", line 231, in run_export
  File "C:\Program Files\ilastik-1.2.0rc7\ilastik-meta\lazyflow\lazyflow\operators\ioOperators\", line 310, in _export_2d
  File "C:\Program Files\ilastik-1.2.0rc7\ilastik-meta\lazyflow\lazyflow\operators\ioOperators\", line 67, in run_export
    assert len(nonzero_dims) <= 2, "Image must have no more than 2 non-singleton dimensions."
AssertionError: Image must have no more than 2 non-singleton dimensions.

ERROR 2016-11-18 10:42:54,033 log_exception 4648 964 Project could not be loaded due to the exception shown above.
Aborting Project Open Action
ERROR 2016-11-18 10:42:54,211 excepthooks 4648 964 Unhandled exception in thread: 'MainThread'


One more question:
Does it matter at all what file output format was choosen in the ilastik project file (Do I need to choose multipage tiff or would hd5 also be fine)?



Hi Christian,

I just saw that the code changes to avoid the unresponsive Ilastik node is still on the nightly only. Could you try that?



Hi Lorenz,

Thanks for the tip. Using the nightly build made the difference. It works now!

Thanks again!