How to develop a custom node which reads multiple image files?

Hi,

I’m a newbie at Knime custom node development and I’m trying to develop a node which reads multiple images based on the specified image extension (.jpg, .png etc.)

I’m able to do this in the NodeDialog using the following code which can select only single image file in the browser-

   public class XXXNodeDialog extends DefaultNodeSettingsPane {
           protected XXXNodeDialog() 
           {
	
	           super();
               createNewGroup("Select image files to be loaded ");
	           DialogComponentFileChooser fileChooser = new DialogComponentFileChooser( 
                                                XXXNodeModel.imgLocation(), "imgDir", 
                                               JFileChooser.OPEN_DIALOG, ".jpg|.jpeg" , ".png" , ".tiff|.tif");
	
	           this.addDialogComponent(fileChooser);  
            }
     }

I’ve tried many ways but couldn’t find any solution for this using DefaultNodeSettingsPane. Now, I’m trying NodeDialogPane – but don’t know how to as there are less examples on this.
Please suggest me anything that could help me do this.

DefaultNodeSettingsPane allows you to use the DialogComponents and SettingsModels. NodeDialogPane requires you to sort out all the load and save of settings yourself and use e.g.Swing components.

Take a look at the Load Text Files node in the Vernalis contribution. Some relevant source code is here:

https://community.knime.org/svn/nodes4knime/trunk/com.vernalis/com.vernalis.knime.io/src/com/vernalis/knime/io/nodes/abstrct/

And here:

https://community.knime.org/svn/nodes4knime/trunk/com.vernalis/com.vernalis.knime.core/src/com/vernalis/knime/dialog/components/

In the latter, have a look at DialogComponentListFilesSelector and SettingsModelStringArrayFlowVarReplaceable

Steve

1 Like

Hi @knimeUser1,
you can take a look at how we did that in the KNIME Image Processing Image Reader node, where we defined a custom DialogComponent:

Speaking of KNIP, is there a specific reason why you can not use it? Are you missing features in the Image Reader node?
best,
Gabriel

1 Like

Hi @gab1one,

Thanks for replying to me!

I already had a look at this one. I tried joining my Knime core nodes with this package, but, couldn’t find a way to merge this package with Knime core functionality.

Please let me know if you have a way to use this package in conjunction with general knime packages. All I could see is eclipse sdk or git clones. Is there a way I can import this package in the eclipse?

Thanks.

HI @knimeUser1,
Developing KNIME Image Processing code requires a special setup, how to get started is explained here:

best,
Gabriel