Group Abstract Group Abstract

Message Boards Message Boards

Functions needed in Image Processing for future release of Mathematica

Update:

Some more desirable functions:

  • Superpixels

  • Graph cut segmentation: the "GrowCutComponents" in Mathematica uses cellular automata. Is the performance better than graph cut?

  • faster execution of Watershed components for 3D images for a considerable number of components.

  • built in functions (based on neural nets) that can be trained on datasets to do binary segmentation or semantic segmentation. Wolfram Neural Net repository nets can be made into special functions perhaps?

  • Interpolate between two binary images in 2D and 3D

Original Post

I am thrilled by the image processing capabilities built into Mathematica and witness its power on a daily basis. I never have to use any other program for image processing, save FIJI. In my opinion Mathematica's image processing core, albeit powerful and broad, can adopt a thing or two from FIJI. As a biophysics student - who works with microscopy images and other images in general - I firmly believe that the suggested functions mentioned below can further add a lot of punch to the image processing core. Furthermore, several of these functions have a role much broader than microscopy/fluorescence microscopy. I sincerely hope that the image processing development team takes a note of the post.

Please let me know in the comments section if some function already exists. And feel free to add functionalities to the list.

DESIRABLE FUNCTIONALITIES

POSTED BY: Ali Hashmi
15 Replies
POSTED BY: Szabolcs Horvát

Hi Shadi,

I made an update of the post: included super pixel, GraphCut segmentation and a possible faster execution for Watershed opponents for 3D.

Regards, Ali

POSTED BY: Ali Hashmi

I am still doing it very crudely and am myself trying to find a way to connect the two together. I will let you know if I get any success !

POSTED BY: Ali Hashmi

Last off-topic message in this thread—if you have figured out a way to control ImageJ/Fiji from within Mathematica, even in a very rudimentary way, please do send me an email. We can continue the discussion there then.

POSTED BY: Szabolcs Horvát
POSTED BY: Ali Hashmi

I second you on this. For my current pipeline, I am doing registration using a plugin in ImageJ and then have to export all those images back to M. If there were an easier integration with other potentially powerful software then it will only make the pace of the work faster and seem a bit effortless.

The best approach then is thus two-pronged: (1) WRI should make it easier for M to interface with other programs (2) to extend the current capabilities of the core.

And I do hope that Charles Pooh is going to do what he said earlier that they are not abandoning Graph and associated functions. We are all aware how important graphs are - in their own right and as a useful data structure.

POSTED BY: Ali Hashmi

I'm veering off-topic though.

I would, of course, like to see the image processing functionality improve too. I would like to see common tools be included as built-in functions.

My point was simply that there will always be many more tools that Wolfram won't have resources to include. Like you, I love to work in Mathematica, so I hope they'll make it as easy as possible to use Mathematica as a glue language and call other systems directly from Mathematica as needed. E.g. J/Link is already very good, but alone it's not enough.

POSTED BY: Szabolcs Horvát
POSTED BY: Szabolcs Horvát

Btw this version of the function written by someone (forgot the name) is slow but sometimes I find it useful:

HistogramTransformationWeightedLocalAdaptive[img_, radius_] := 
  Module[{funs, nodes, w, h, f, fun, fi},
   funs = Map[HistogramTransformInterpolation, ImagePartition[img, {2*radius + 1}], {2}];
   {w, h} = ImageDimensions@img;
   nodes = Map[Mean@Flatten[N@ImageData[#, Automatic], 1] &, 
     ImagePartition[Image[Array[{#1, #2} &, {h, w}], "Bit16"], {2*radius + 1}], {2}];
   nodes = ArrayPad[nodes, {{1, 1}, {1, 1}}, "Fixed"];
   nodes[[All, {1, -1}, 2]] = {1, w};
   nodes[[{1, -1}, All, 1]] = {1, h};
   funs = ArrayPad[funs, 1, "Fixed"];
   fi = Interpolation[Thread[{Round@Flatten[nodes, 1], 
       Table[f[#], {f, Flatten@funs}]}], InterpolationOrder -> 1];
   fun[v_, {r_, c_}] := Evaluate[fi[r, c]] &[v];
   Quiet@ImageApplyIndexed[fun, img]
   ];

enter image description here

POSTED BY: Ali Hashmi
POSTED BY: Ali Hashmi

Can you clarify what you mean by 16-bit image display?

As for Fiji, I asked a question about interoperability here:

Mathematica can't be expected to have everything Fiji has (especially special plugins!) but it would be great if I could use Mathematica as the centre of my workflow and still employ ImageJ for certain specific tasks. It seems that J/Link currently has some limitations that make it difficult to use ImageJ (and I now knowing much Java didn't help ...) I wrote to Wolfram Support about this and the feedback I got so far sounded encouraging (i.e. that they'd look into making things work). Let's see how that works out!

I also have a small LTemplate-based framework to make it easier to call SimpleITK functions directly from Mathematica. Sometimes SimpleITK has useful stuff that Mathematica doesn't (e.g. local histogram equalization, which I hope Mathematica will get in the future).

Occasionally I use MATLAB stuff too through MATLink.

Overall, what I am wishing for the most is better interoperability with other systems.

If some operation is built-in, that's obviously the best. But Wolfram only has limited resources. A high-quality interface to other systems, or toolkits that make it easier to build such interfaces (like LTemplate), can often give the highest benefit for the least amount of work.

POSTED BY: Szabolcs Horvát

Thanks Shadi for taking note of the post. I am really looking forward to the new functionalities that you and your team will incorporate in the next release(s). I will also remove those features from my post that have already been implemented (e.g. Strahler Analysis and Morphological Segmentation) or at least mention that they are already there :)

POSTED BY: Ali Hashmi

Thanks Sander ! was really hidden :)

POSTED BY: Ali Hashmi
POSTED BY: Shadi Ashnai

i know that the first one is already there, albeit a bit hidden:

ClearAll[oFindImageCircles]
oFindImageCircles[img_/;ImageQ@img&&ImageChannels@img==1,
{sizemin_Integer,sizemax_Integer},(*range of radii for circles*)
mindist_Real,(*minimum distance in between circle centers*)
thrCanny_Real,(*minimum canny edge strength---the function computes edge detection on the input*)
thrStrength_Real,(*minimum strength of circle (aka votes)*)
resolutionfactor_,(*between 0 and 1,how big is the hough array compared to the image*)
nmax_  (*max number of circles*)
]:=Module[{res},Needs["OpenCVLink`"];
    res=OpenCVLink`Private`$HoughCircles[img,1/resolutionfactor,mindist,(255*thrCanny),thrStrength,sizemin,sizemax];(*sorted by strength already*)
    If[Head@res=!=List,Throw@$Failed];
        res={{#1,#2},#3}&@@@Partition[res,3];
        If[nmax===All,
            res,
            Take[res,UpTo[nmax]]
        ]
];
POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard