lama/elastix/propagate_volumes.py
def _propagate(self, labelmap, tform, outdir: Path, threads=None):
        """
        Using the iverted elastix transform paramter file, invert a volume with transformix

        Parameters
        ----------
        vol: str
            path to volume to invert
        tform: str
            path to save inverted specimen volume
        outdir:
            path to save transformix output
        rename_output: str
            rename the transformed volume to this
        threads: str/None
            number of threads for transformix to use. if None, use all available cpus
        Returns
        -------
        str/bool
            path to new img if succesful else False
        """

        old_img = outdir / TRANSFORMIX_OUT       # where the transformix-inverted labelmap will be

        id_ = outdir.name
        new_output_name = outdir / f'{id_}.nrrd'  # Renamed transformix-inverted labelmap

        # if self.noclobber and isfile(new_output_name):
        # Maybe need to do two types of noclobber
        # 1: where if the folder does not exist, do not do it
        # 2: where the folder exists but the final output file does not exist
        #     return None

        cmd = [
            'transformix',
            '-in', str(labelmap),
            '-tp', str(tform),
            '-out', str(outdir)
        ]

        if threads:
            cmd.extend(['-threads', str(threads)])
        try:
            subprocess.check_output(cmd)
        except Exception as e:
            logging.exception('{}\ntransformix failed propagating labelmap: {}'.format(e, labelmap))
            raise

        try:
            shutil.move(old_img, new_output_name)
        except IOError as e:
            print()
            'could not rename {}'.format(old_img)
            return old_img
        else:
            return new_output_name

        Using the iverted elastix transform paramter file, invert a volume with transformix

        Parameters
        ----------
        vol: str
            path to volume to invert
        tform: str
            path to save inverted specimen volume
        outdir:
            path to save transformix output
        rename_output: str
            rename the transformed volume to this
        threads: str/None
            number of threads for transformix to use. if None, use all available cpus
        Returns
        -------
        str/bool
            path to new img if succesful else False
        
Using the iverted elastix transform paramter file, invert a volume with transformix
Parameters

str
path to volume to invert
tform: str
path to save inverted specimen volume
outdir:
path to save transformix output
rename_output: str
rename the transformed volume to this
threads: str/None
number of threads for transformix to use. if None, use all available cpus
Returns

str/bool
path to new img if succesful else False
Using the iverted elastix transform paramter file invert a volume with transformix Parameters str path to volume to invert tform : str path to save inverted specimen volume outdir : path to save transformix output rename_output : str rename the transformed volume to this threads : str / None number of threads for transformix to use . if None use all available cpus Returns str / bool path to new img if succesful else False
def _propagate(self, labelmap, tform, outdir: Path, threads=None):
        old_img = outdir / TRANSFORMIX_OUT       
        id_ = outdir.name
        new_output_name = outdir / f'{id_}.nrrd'  
        cmd = [
            'transformix',
            '-in', str(labelmap),
            '-tp', str(tform),
            '-out', str(outdir)
        ]
        if threads:
            cmd.extend(['-threads', str(threads)])
        try:
            subprocess.check_output(cmd)
        except Exception as e:
            logging.exception('{}\ntransformix failed propagating labelmap: {}'.format(e, labelmap))
            raise
        try:
            shutil.move(old_img, new_output_name)
        except IOError as e:
            print()
            'could not rename {}'.format(old_img)
            return old_img
        else:
            return new_output_name
def _propagate ( self , labelmap , tform , outdir : Path , threads = None ) : old_img = outdir / TRANSFORMIX_OUT id_ = outdir . name new_output_name = outdir / f'{id_}.nrrd' cmd = [ 'transformix' , '-in' , str ( labelmap ) , '-tp' , str ( tform ) , '-out' , str ( outdir ) ] if threads : cmd . extend ( [ '-threads' , str ( threads ) ] ) try : subprocess . check_output ( cmd ) except Exception as e : logging . exception ( '{}\ntransformix failed propagating labelmap: {}' . format ( e , labelmap ) ) raise try : shutil . move ( old_img , new_output_name ) except IOError as e : print ( ) 'could not rename {}' . format ( old_img ) return old_img else : return new_output_name
Using the iverted elastix transform paramter file, invert a volume with transformix
Parameters
Using the iverted elastix transform paramter file invert a volume with transformix Parameters
"""
        Using the iverted elastix transform paramter file, invert a volume with transformix

        Parameters
        ----------
        vol: str
            path to volume to invert
        tform: str
            path to save inverted specimen volume
        outdir:
            path to save transformix output
        rename_output: str
            rename the transformed volume to this
        threads: str/None
            number of threads for transformix to use. if None, use all available cpus
        Returns
        -------
        str/bool
            path to new img if succesful else False
        """ # where the transformix-inverted labelmap will be # Renamed transformix-inverted labelmap # if self.noclobber and isfile(new_output_name): # Maybe need to do two types of noclobber # 1: where if the folder does not exist, do not do it # 2: where the folder exists but the final output file does not exist #     return None
self
labelmap
tform
outdir
Path
threads