I'm aware of the solution to a similar problem by Hayashi Yoshiaki. Is there a way of extending the solution to break out the chromosomes from this example I have a mass of data in this format that needs to be converted to a training set. Note the there are holes in the chromosome that the human ignores when segmenting. Doing this manually for hundreds of images is a challenge. Thanks in advance
$\begingroup$ $\endgroup$
6 - $\begingroup$ Please give a link to Yoshiaki's solution. $\endgroup$C. E.– C. E. ♦2017-07-31 17:30:10 +00:00Commented Jul 31, 2017 at 17:30
- $\begingroup$ mathematica.stackexchange.com/questions/109154/… $\endgroup$Boris– Boris2017-07-31 17:47:10 +00:00Commented Jul 31, 2017 at 17:47
- $\begingroup$ Are all your images aligned and roughly equally spaced like this one? $\endgroup$yohbs– yohbs2017-07-31 18:55:26 +00:00Commented Jul 31, 2017 at 18:55
- $\begingroup$ Yes, thats right. They are autogenerated. some are long and bent but all are essentially equidistant. $\endgroup$Boris– Boris2017-07-31 19:00:26 +00:00Commented Jul 31, 2017 at 19:00
- $\begingroup$ This image looks pretty easy to divide, to the extent that a very straightforward algorithm can be written (basically - detecting columns that are almost totally white). It would be helpful if you could provide a few more samples so that we can check the robustness. $\endgroup$yohbs– yohbs2017-07-31 19:14:05 +00:00Commented Jul 31, 2017 at 19:14
| Show 1 more comment
1 Answer
$\begingroup$ $\endgroup$
6 Here's the very straightforward method I suggested in my comment:
tot = Total@ImageData[Binarize[im, 0.9]]; columnsSequence = Flatten@Position[tot, x_ /; x >= 103]; columns = Round@(Mean /@ Split[columnsSequence, #2 - #1 == 1 &]); imd = ImageData[im]; imd[[All, columns, All]] = 0; Image[imd] This is just drawing the lines that separate the chromosomes. From here you can split the image or do any other further manipulation. For calculating the best separating "white column" I used this trick.
Here's how to divide the image to subimages:
imd=ImageData[ims] images = Table[ imd[[All, columns[[i]] ;; columns[[i + 1]], All]], {i, Length[columns] - 1}] Image /@ images - $\begingroup$ OK, its a good start - how do I generate a list of images from this? I'll post a page of data from one example in the morning. $\endgroup$Boris– Boris2017-07-31 22:31:19 +00:00Commented Jul 31, 2017 at 22:31
- $\begingroup$ Hi yohbs, Ive tested your routine on other sets and find that I need to adjust the position parameter but thats OK I can automate that. Im having trouble breaking out the individual components due to my limited familiarity with array handling. I shall persevere. $\endgroup$Boris– Boris2017-08-01 10:28:15 +00:00Commented Aug 1, 2017 at 10:28
- $\begingroup$ this seems to work- not elegant Im afraid: $\endgroup$Boris– Boris2017-08-01 13:59:23 +00:00Commented Aug 1, 2017 at 13:59
- $\begingroup$ pt1 = Drop[Partition[Riffle[columns, 0], 2], -1]; pt2 = Drop[Partition[Riffle[columns, 116], 2], 1]; components = Partition[Partition[Flatten[Transpose[{pt1, pt2}]], 2], 2]; images = ImageTrim[im, #] & /@ components $\endgroup$Boris– Boris2017-08-01 14:00:26 +00:00Commented Aug 1, 2017 at 14:00
- $\begingroup$ @Boris You can do it more cleanly. I'll edit my answer. $\endgroup$yohbs– yohbs2017-08-01 14:04:48 +00:00Commented Aug 1, 2017 at 14:04


