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

Before Change


        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

    def centre_of_mass(self):
        return np.mean(np.argwhere(self.seg > self.threshold), 0)
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: chainer/chainerrl
Commit Name: 958d553f14b281fd8ec15e83d436a61f35340bff
Time: 2018-11-11
Author: muupan@gmail.com
File Name: chainerrl/experiments/train_agent_batch.py
Class Name:
Method Name: train_agent_batch


Project Name: chainer/chainerrl
Commit Name: b46c662d976cc13bc9d7aecd3b0487475a8ee3d0
Time: 2018-11-11
Author: muupan@gmail.com
File Name: chainerrl/experiments/evaluator.py
Class Name:
Method Name: batch_run_evaluation_episodes


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