CLARITY ROI Analysis

Reference: CLARITY ROI Analysis February 9, 2015

The goal of this analysis is to show the statistical differences between the different classes of CLARITY brains. For each ROI, fourteen different properties were computed. The analysis shows that it is possible to demonstrate statistical differences between the various classes of CLARITY brains when using unsupervised clustering methods.


In [1]:
import os
PATH="/Users/david/Desktop/CourseWork/TheArtOfDataScience/claritycontrol/code/scripts/" # use your own path
os.chdir(PATH)

import clarity.resources as rs
import nibabel as nib
import numpy as np
import matplotlib.pyplot as plt
import jgraph as ig
import csv,gc  # garbage memory collection :)

%matplotlib inline

Normalization


In [2]:
path = rs.RAW_DATA_PATH
token = "Fear199"
pathname = path+token+".img"
img_volume = nib.load(pathname).get_data()[:,:,:,0]
normalized_volume = (img_volume-np.mean(img_volume))/np.std(img_volume)

ROI Extraction


In [3]:
# Don't know how to extract ROIs using the Allen Mouse Brain Atlas
ROIS = [normalized_volume]


[[[-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  ..., 
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]]

 [[-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [ 0.0643992   0.13851063  0.0643992  ...,  0.21262206  0.21262206
    0.08292706]
  [ 0.13851063  0.17556635  0.13851063 ...,  0.13851063  0.10145492
    0.17556635]
  ..., 
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]]

 [[-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [ 0.13851063  0.17556635  0.13851063 ...,  0.10145492  0.24967778
    0.08292706]
  [ 0.17556635  0.13851063  0.11998277 ...,  0.17556635  0.10145492
    0.11998277]
  ..., 
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]]

 ..., 
 [[-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  ..., 
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]]

 [[-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  ..., 
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]]

 [[-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  ..., 
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]
  [-1.73280298 -1.73280298 -1.73280298 ..., -1.73280298 -1.73280298
   -1.73280298]]]

Create GLCM and extracting statistical measures


In [ ]:
def getGLCM(roi):
    #Generating GLCM matrix
    pass

def 

for roi in ROIS:
    matrix = getGLCM(roi)
    matrix = matrix/sum(matrix)  # normalize

Mean and Standard Deviation


In [ ]: