Wednesday, December 7, 2016

Morphing DNA Causes Cancer

Now we're gonna learn about the mighty morphological operations.
These are operations that perform certain transformations to images, usually by adding or removing pixels.

For the sake of this activity we will only deal with binary black and white images.
The most important part in applying morphological operations is the Structure or Structuring Element (SE). This is a template of sorts that we will use to perform the transformations.

The basic morphological operations are the $DILATION$ and $EROSION$.
In Dilation, we survey all pixels in the image. We will impose the the reflection of the structuring element on each of these pixels. If the "whites" of the imposed SE encounters a "white" pixel in the image, the pixel where the SE is imposed turns white, potentially adding more white pixels in the image.

In set notation, the dilation of image A by SE B is
$A \oplus B = \{ z|(\hat{B})_z \cap A \neq \emptyset \}$

In Erosion, we impose the structure element on all the white pixels. If any of the whites of the imposed SE encounters a black pixel in the image, the pixel where the SE is imposed turns black.

In set notation the erosion of image A by SE B is
$A \ominus B = \{ z| B_z \subseteq A \}$

Here are some examples of how Dilation and Erosion works
In the following pictures, the first row show the original image.
The second row shows the structuring element. The third and fourth shows what happens after Dilation and Erosion respectively.

Boxes with hash represent white pixels.
Blue plus (+) signs show white pixels to be added after dilation
Red minus (-) signs show white pixels to be turned black after erosion


Yes I know this was supposed to be a triangle with 4px base and 3px height but I don't know how to draw that properly so here's a triangle with 5px base.



And this one has a weird configuration due to space limitations


Bro that looks messy. Can you computerize that.
In time my friend... in time.


Well... adding and subtracting white dots doesn't seem useful now does it?
That's because you don't know $SCIENCE$
Stop saying "science" like it's a magic word, you're giving me cancer.
Well why don't we take tissue samples from you and check if you got cancer.
Wha... What?
Oh yeah. With the power of morphological operations we are going to identify cancer cells. Because ...
Let me guess. Science?
$SCIENCE!$

Now here is a bunch of circles. Yep those are cells, normal-looking cells. Believe me they are.
But where? It's all gray and stuff.
Remember image segmentation? Well... $BOOM \, SEGMENTED$

El Oh El. You like totally feyald. Ewl. Noowb
That's the limit of segmenting by threshold. Now behold the power of...
Science?
Wha? No. $MORPHOLOGICAL \, OPERATIONS$
Specifically we will use the OPEN operation. This is defined as an Erosion followed by a Dilation.
Why?
Because, using Erosion we can remove the smaller "noise"-like pixels blobs. Then by using Dilation, we can restore-ish the bigger blobs to their original form. All right let's do this.

$Krakabooom$
Behold the power of $OPEN$ operation
This is done by using a 10px circular SE

Okay now what?
Now we can find the size of normal cells. Here's the pdf broh.
$\mu = 695$ $sigma = 521$
Wha? 521 standard dev?
I dunno man. That's what Scilab gave me.
Well whatever. From this I determined that normal sized cells have an area of about 550-750 pixels. 
Determined? More like declared so.
Yeah yeah whatever.  
Anyway. Here is the picture of your cells. YES THEY ARE.
$YES...THEY...ARE$

We expect that cancer cells are bigger than ordinary cells. Because they are greedy as $\mathcal{F} \cup \subset \prec$
Using our might morphological operations the sample is segmented. And then $BANG$ by the power of FilterBySize, I isolated the odd-sized blobs. And viola.

$BOOM \, YOU \, HAVE \, CANCER$



Yeahp you got 5 cancer cells alright.
Bu...
$SCIENCE$




Mehehehe again I'm setting my standards low here.
For a Mission accomplished, I'm giving myself a 10/10!
No no, your dilation/erosion sucks
Fine, I'm giving myself a $9/10$ 

Special thanks to this German(?) guy for explaining-ish dilation and erosion
And thanks to Mr. Kit Guial for pointing out that video

No comments:

Post a Comment