K-Means on Images

I am trying to perform basic K-Means on images and have prepared the following workflow. It appears the only way to to use (image below, workflow attached) the Image to Data Row combined with Ungroup, then k-Means then category to number, then math formula (to add a dummy 0 column for group by to use) then group by then data row to image. Is there a more elegant way to do this?

Also it would be nice to have variable sized images, but image to datarow does not spit out the image size, it would be nice if it output the image size as well so image to datarow and data row to image could be connected together. 

Finally, it would be really nice, to have the spatial coordinates (x,y,z,...) so they could be used in the k-Means or whatever other classifier would go inside. Is there an elegant way of doing this?

 

Thanks,

Kevin

So I have fixed both issues I requested, and it works, but is very hacky, I really hope there is a more elegant way to run this.

There was already a discussion about cluster algorithms to images in this forum.

Link -> http://tech.knime.org/forum/knime-image-processing/applying-cluster-nodes-on-images

 

Isn't that what you are trying to achieve?