ae9cf55f6a5775a0d39a869166e8b33d4f39c273,region_properties.py,RegionProperties,__compute_mask,#RegionProperties#,59

Before Change


        mask_temp = 1 - self.seg
        mask_temp[mask_temp < 0.5] = False
        mask_temp[mask_temp >= 0.5] = True
        mask_temp = np.tile(mask_temp, [1, 1, 1, self.img.shape[3]])
        masked_array = ma.masked_array(self.img, mask_temp)
        return masked_array.reshape(-1, masked_array.shape[-1])

    def centre_of_mass(self):
        return np.mean(np.argwhere(self.seg > self.threshold), 0)

After Change


    def __compute_mask(self):
        // TODO: check whether this works for probabilities type
        foreground_selector = np.where((self.seg > 0).reshape(-1))[0]
        probs = self.seg.reshape(-1)[foreground_selector]
        regions = np.zeros((foreground_selector.shape[0], self.img_channels))
        for i in np.arange(self.img_channels):
            regions[:,i] = self.img[..., i].reshape(-1)[foreground_selector]
        return regions, probs
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: NifTK/NiftyNet
Commit Name: ae9cf55f6a5775a0d39a869166e8b33d4f39c273
Time: 2017-04-12
Author: wenqi.li@ucl.ac.uk
File Name: region_properties.py
Class Name: RegionProperties
Method Name: __compute_mask


Project Name: deepchem/deepchem
Commit Name: 29c11f550c6b8d9e379afce9b9a2315552884b6c
Time: 2017-03-22
Author: bharath.ramsundar@gmail.com
File Name: deepchem/models/tf_new_models/vina_model.py
Class Name: VinaModel
Method Name: construct_graph


Project Name: naturomics/CapsLayer
Commit Name: ba2a24b71528b0439e18d028d242635021a3bf25
Time: 2017-11-26
Author: naturomics.liao@gmail.com
File Name: capslayer/layers.py
Class Name:
Method Name: fully_connected