@staticmethod
    def get_labelmap_slices(np_array):
        """ Get a dictionary with the slices where all the label data are contained in a numpy array
        representing a labelmap.
        The output will be a dictionary of [label_Code: array of slices]
        Method 1: "2 steps" process compressing the array. It works much better when there are few slices with data
        :param np_array: numpy array representing the image
        :return: dictionary of [label_Code: numpy array of slices]
        """
        #start = time.clock()
        # Get an array with the slices that contain any data
        positions = np.where(0 > np_array)
        slices = np.unique(positions[0])
         
        # Build a new array just with the slices that contain data
        boundArray = np_array[slices,:,:]
         
        # Search for all the different label maps
        labelMaps = np.unique(boundArray)
         
        result = {}    
        for label in (label for label in labelMaps if label>0):
            # Get the slices that contain the label
            s = np.where(boundArray == label)
            # "Translate" to the true slice numbers and store the result
            result[label] = slices[np.unique(s[0])] 
        
    #     end = time.clock()
    #     print ("get_labelmap_slices_from_numpy_array took {0} seconds".format(end-start))
         
        return result
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/CIP_Common/CIP/logic/Util.py/Util.get_labelmap_slices/swapped operands of `>`