How do I evaluate the performance of a segmentation algorithm?
Given that you are working only on Tanimoto Coefficient, i am trying to be more specific rather than giving generic answer with various different approaches. 

The basic notation of Tanimoto Coefficient is as follows:

$$
T(A,B) = { N_{AB} \over N_A + N_B - N_{AB} } 
$$

where $T$ is the desired result, over $A$ and $B$ images. 

In this measure, we identify pixels either as belonging to a given segment i.e. it is segment pixel or it is background.
$N$ refers to number of pixels that are classified as segment pixel in the respective image. And $N_{AB}$ refers to the number of pixels which are classified as segment pixel in both images. 

In this measure all pixels which qualifies as neither in A nor B is not calculated; only the pixels.  

Also, both image must have same resolution and must have identical locations to for the segmented objects else even if the segmentation shape is right, the resultant overlap may not be right. 

I am not getting into your MATLAB code, but here is the pseudo code that looks like. 

Initialize N_A, N_B, N_AB;
for( all pixels @ x,y) 
{
   if(image_A[x][y] == SEGMENT_CLASS_PIXEL) 
    N_A += 1;

   if(image_B[x][y] == SEGMENT_CLASS_PIXEL) 
    N_A += 1;

   if(image_A[x][y] == SEGMENT_CLASS_PIXEL 
      &amp;&amp; image_B[x][y] == SEGMENT_CLASS_PIXEL) 
    N_AB += 1;

}

T = N_AB / (N_A + N_B - N_AB);