In [1]:
import sys
sys.path.append('../code/functions')
sys.path.append('../code/tests')

In [8]:
import cv2
import quality

from cluster import Cluster
from scipy import ndimage
from neighborhoodLib import neighborhoodDensity

import connectLib as cLib
import mouseVis as mv
import tiffIO as tIO
import cPickle as pickle
import hyperReg as hype
import matplotlib.pyplot as plt
import pipeline as current

import plotly
plotly.offline.init_notebook_mode()



In [20]:
data = pickle.load(open('../code/tests/synthDat/realDataRaw_t1.io'))

In [26]:
smallData=data[70:90]

Current Pipeline Version


In [33]:
%%time
currentClusters3, curBin3 = current.pipeline(smallData,
                                           interPlane=3,
                                           intraPlane=3,
                                           volThreshLowerBound=25,
                                           volThreshUpperBound=250,
                                           meanNormSlices=True,
                                           verbose=False,
                                           returnBinary = True)


CPU times: user 1min 45s, sys: 524 ms, total: 1min 46s
Wall time: 1min 45s

In [34]:
%%time
currentClusters5, curBin5 = current.pipeline(smallData,
                                           interPlane=5,
                                           intraPlane=5,
                                           volThreshLowerBound=25,
                                           volThreshUpperBound=250,
                                           meanNormSlices=True,
                                           verbose=False,
                                           returnBinary = True)


CPU times: user 1min 55s, sys: 460 ms, total: 1min 56s
Wall time: 1min 55s

In [35]:
%%time
currentClusters7, curBin7 = current.pipeline(smallData,
                                           interPlane=7,
                                           intraPlane=7,
                                           volThreshLowerBound=25,
                                           volThreshUpperBound=250,
                                           meanNormSlices=True,
                                           verbose=False,
                                           returnBinary = True)


CPU times: user 2min 1s, sys: 272 ms, total: 2min 1s
Wall time: 2min 1s

In [47]:
plt.figure()
plt.imshow(smallData[5], cmap='gray')
plt.title('Raw data')
plt.show()

plt.figure()
plt.imshow(smallData[5]*5, cmap='gray')
plt.title('Raw data with artificial brightening')
plt.show()



In [37]:
cLib.clusterAnalysis(curBin3)


Number of clusters: 1328
Average Volume: 50.1701807229
Cluster Density: 0.00635395050049

In [38]:
cLib.clusterAnalysis(curBin5)


Number of clusters: 1370
Average Volume: 49.3306569343
Cluster Density: 0.00644521713257

In [39]:
cLib.clusterAnalysis(curBin7)


Number of clusters: 1307
Average Volume: 48.6870696251
Cluster Density: 0.00606861114502

In [51]:
plt.figure()
plt.imshow(curBin3[5], cmap='gray')
plt.title('Binary output with neighborhood=3')
plt.show()

plt.figure()
plt.imshow(curBin5[5], cmap='gray')
plt.title('Binary output with neighborhood=5')
plt.show()

plt.figure()
plt.imshow(curBin7[5], cmap='gray')
plt.title('Binary output with neighborhood=7')
plt.show()



In [52]:
plt.figure()
plt.imshow(smallData[5], cmap='gray')
plt.title('Raw data')
plt.show()

plt.figure()
plt.imshow(smallData[5]*5, cmap='gray')
plt.title('Raw data with artificial brightening')
plt.show()



In [53]:
%%time
currentClustersLargeInter, curBinLargeInter = current.pipeline(smallData,
                                           interPlane=10,
                                           intraPlane=5,
                                           volThreshLowerBound=25,
                                           volThreshUpperBound=250,
                                           meanNormSlices=True,
                                           verbose=False,
                                           returnBinary = True)


CPU times: user 2min 33s, sys: 636 ms, total: 2min 34s
Wall time: 2min 34s

In [56]:
plt.figure()
plt.imshow(curBinLargeInter[5], cmap='gray')
plt.title('Binary output with interN=10, intraN=5')
plt.show()

plt.figure()
plt.imshow(curBin5[5], cmap='gray')
plt.title('Binary output with interN=5, intraN=5')
plt.show()



In [66]:
%%time
currentClustersLargeInter15, curBinLargeInter15 = current.pipeline(smallData,
                                           interPlane=15,
                                           intraPlane=5,
                                           volThreshLowerBound=25,
                                           volThreshUpperBound=250,
                                           meanNormSlices=True,
                                           verbose=False,
                                           returnBinary = True)


CPU times: user 3min 17s, sys: 308 ms, total: 3min 17s
Wall time: 3min 17s

In [70]:
plt.figure()
plt.imshow(curBinLargeInter15[5], cmap='gray')
plt.title('Binary output with interN=15, intraN=5')
plt.show()



In [68]:
%%time
currentClustersLargeInter25, curBinLargeInter25 = current.pipeline(smallData,
                                           interPlane=25,
                                           intraPlane=5,
                                           volThreshLowerBound=25,
                                           volThreshUpperBound=250,
                                           meanNormSlices=True,
                                           verbose=False,
                                           returnBinary = True)


CPU times: user 5min 30s, sys: 324 ms, total: 5min 30s
Wall time: 5min 30s

In [71]:
plt.figure()
plt.imshow(curBinLargeInter25[5], cmap='gray')
plt.title('Binary output with interN=25, intraN=5')
plt.show()



In [72]:
plt.figure()
plt.imshow(curBin5[5], cmap='gray')
plt.title('Binary output with interN=5, intraN=5')
plt.show()



In [ ]: