In [1]:
%pylab inline
In [2]:
import gp
In [3]:
input_image, input_prob, input_gold, input_rhoana, dojo_bbox = gp.Legacy.read_dojo_data()
In [4]:
merged = gp.Util.view_labels(input_rhoana[8], [68,70], crop=False, return_it=True)
split = np.array(merged)
In [5]:
merged[merged==1] = 2
In [6]:
imshow(merged)
Out[6]:
In [7]:
imshow(split)
Out[7]:
In [8]:
imshow(input_gold[8])
Out[8]:
In [9]:
# bjoern's VI
import partition_comparison
print 'VI merged<->gold', partition_comparison.variation_of_information(merged.astype(np.uint32).ravel(), input_gold[8].ravel())
print 'VI split<->gold', partition_comparison.variation_of_information(split.astype(np.uint32).ravel(), input_gold[8].ravel())
In [10]:
# bjoern's RandIndex
print 'RI merged<->gold', partition_comparison.rand_index(merged.astype(np.uint32).ravel(), input_gold[8].ravel())
print 'RI split<->gold', partition_comparison.rand_index(split.astype(np.uint32).ravel(), input_gold[8].ravel())
In [11]:
# ITTK VI (https://github.com/MaxwellRebo/ittk/blob/master/ittk/main.py)
import sys
sys.path.append('../ittk/')
from ittk import main
print 'VI merged<->gold', main.information_variation(merged.astype(np.uint32).ravel(), input_gold[8].ravel())
print 'VI split<->gold', main.information_variation(split.astype(np.uint32).ravel(), input_gold[8].ravel())
In [12]:
# GALA VI
from gala import evaluate
print 'VI merged<->gold', evaluate.vi(merged, input_gold[8])
print 'VI split<->gold', evaluate.vi(split, input_gold[8])
In [13]:
merged = gp.Util.view_labels(input_rhoana[8], [20,31], crop=False, return_it=True)
split = np.array(merged)
In [14]:
merged[merged==1] = 2
In [15]:
imshow(merged)
Out[15]:
In [16]:
imshow(split)
Out[16]:
In [17]:
imshow(input_gold[8])
Out[17]:
In [18]:
# bjoern's VI
import partition_comparison
print 'VI merged<->gold', partition_comparison.variation_of_information(merged.astype(np.uint32).ravel(), input_gold[8].ravel())
print 'VI split<->gold', partition_comparison.variation_of_information(split.astype(np.uint32).ravel(), input_gold[8].ravel())
In [19]:
# bjoern's RandIndex
print 'RI merged<->gold', partition_comparison.rand_index(merged.astype(np.uint32).ravel(), input_gold[8].ravel())
print 'RI split<->gold', partition_comparison.rand_index(split.astype(np.uint32).ravel(), input_gold[8].ravel())
In [20]:
# ITTK VI (https://github.com/MaxwellRebo/ittk/blob/master/ittk/main.py)
import sys
sys.path.append('../ittk/')
from ittk import main
print 'VI merged<->gold', main.information_variation(merged.astype(np.uint32).ravel(), input_gold[8].ravel())
print 'VI split<->gold', main.information_variation(split.astype(np.uint32).ravel(), input_gold[8].ravel())
In [21]:
# GALA VI
from gala import evaluate
print 'VI merged<->gold', evaluate.vi(merged, input_gold[8])
print 'VI split<->gold', evaluate.vi(split, input_gold[8])
In [22]:
print 'VI split<->gold', evaluate.vi(split, input_gold[8])
In [23]:
print 'VI split<->gold', evaluate.vi(split.ravel(), input_gold[8].ravel())
In [ ]: