(self, com, size)
return xstart, xend, ystart, yend, zstart, zend
Calculate boundaries, project to 3D, then add offset and backproject to 2D (ux, uy are canceled)
        :param com: center of mass, in image coordinates (x,y,z), z in mm
        :param size: (x,y,z) extent of the source crop volume in mm
        :return: xstart, xend, ystart, yend, zstart, zend
Calculate boundaries, project to 3D, then add offset and backproject to 2D (ux, uy are canceled)
        :param com: center of mass, in image coordinates (x,y,z), z in mm
        :param size: (x,y,z) extent of the source crop volume in mm
        :return: xstart, xend, ystart, yend, zstart, zend
Calculate boundaries project to 3D then add offset and backproject to 2D ( ux uy are canceled ) : param com : center of mass in image coordinates ( x y z ) z in mm : param size : ( x y z ) extent of the source crop volume in mm : return : xstart xend ystart yend zstart zend
def comToBounds(self, com, size):
        """
        Calculate boundaries, project to 3D, then add offset and backproject to 2D (ux, uy are canceled)
        :param com: center of mass, in image coordinates (x,y,z), z in mm
        :param size: (x,y,z) extent of the source crop volume in mm
        :return: xstart, xend, ystart, yend, zstart, zend
        """
        if numpy.isclose(com[2], 0.):
            print ("Warning: CoM ill-defined!")
            xstart = self.dpt.shape[0]//4
            xend = xstart + self.dpt.shape[0]//2
            ystart = self.dpt.shape[1]//4
            yend = ystart + self.dpt.shape[1]//2
            zstart = self.minDepth
            zend = self.maxDepth
        else:
            zstart = com[2] - size[2] / 2.
            zend = com[2] + size[2] / 2.
            xstart = int(numpy.floor((com[0] * com[2] / self.fx - size[0] / 2.) / com[2]*self.fx+0.5))
            xend = int(numpy.floor((com[0] * com[2] / self.fx + size[0] / 2.) / com[2]*self.fx+0.5))
            ystart = int(numpy.floor((com[1] * com[2] / self.fy - size[1] / 2.) / com[2]*self.fy+0.5))
            yend = int(numpy.floor((com[1] * com[2] / self.fy + size[1] / 2.) / com[2]*self.fy+0.5))
        return xstart, xend, ystart, yend, zstart, zend
def comToBounds ( self , com , size ) : if numpy . isclose ( com [ 2 ] , 0. ) : print ( "Warning: CoM ill-defined!" ) xstart = self . dpt . shape [ 0 ] // 4 xend = xstart + self . dpt . shape [ 0 ] // 2 ystart = self . dpt . shape [ 1 ] // 4 yend = ystart + self . dpt . shape [ 1 ] // 2 zstart = self . minDepth zend = self . maxDepth else : zstart = com [ 2 ] - size [ 2 ] / 2. zend = com [ 2 ] + size [ 2 ] / 2. xstart = int ( numpy . floor ( ( com [ 0 ] * com [ 2 ] / self . fx - size [ 0 ] / 2. ) / com [ 2 ] * self . fx + 0.5 ) ) xend = int ( numpy . floor ( ( com [ 0 ] * com [ 2 ] / self . fx + size [ 0 ] / 2. ) / com [ 2 ] * self . fx + 0.5 ) ) ystart = int ( numpy . floor ( ( com [ 1 ] * com [ 2 ] / self . fy - size [ 1 ] / 2. ) / com [ 2 ] * self . fy + 0.5 ) ) yend = int ( numpy . floor ( ( com [ 1 ] * com [ 2 ] / self . fy + size [ 1 ] / 2. ) / com [ 2 ] * self . fy + 0.5 ) ) return xstart , xend , ystart , yend , zstart , zend