lama/elastix/deformations.py
def _chain_tforms(tforms: List):
    """
    Add the initial paramter file paths to the tform files
    We don't use this now as all the transforms are merged into one by elastix
    :return:
    """
    if len(tforms) < 2:  # Cannot have initial tform file as we need at least 2
        return

    for i, tp in enumerate(tforms[1:]):
        initial_tp = tforms[i]

        with open(tp, 'r') as fh:
            lines = []
            for line in fh:
                if line.startswith('(InitialTransformParametersFileName'):
                    continue
                lines.append(line)

        previous_tp_str = '(InitialTransformParametersFileName "{}")'.format(initial_tp)
        lines.insert(0, previous_tp_str + '\n')
        with open(tp, 'w') as wh:
            for line in lines:
                wh.write(line)

    Add the initial paramter file paths to the tform files
    We don't use this now as all the transforms are merged into one by elastix
    :return:
    
Add the initial paramter file paths to the tform files
We don't use this now as all the transforms are merged into one by elastix
Add the initial paramter file paths to the tform files We don ' t use this now as all the transforms are merged into one by elastix
def _chain_tforms(tforms: List):
    if len(tforms) < 2:  
        return
    for i, tp in enumerate(tforms[1:]):
        initial_tp = tforms[i]
        with open(tp, 'r') as fh:
            lines = []
            for line in fh:
                if line.startswith('(InitialTransformParametersFileName'):
                    continue
                lines.append(line)
        previous_tp_str = '(InitialTransformParametersFileName "{}")'.format(initial_tp)
        lines.insert(0, previous_tp_str + '\n')
        with open(tp, 'w') as wh:
            for line in lines:
                wh.write(line)
def _chain_tforms ( tforms : List ) : if len ( tforms ) < 2 : return for i , tp in enumerate ( tforms [ 1 : ] ) : initial_tp = tforms [ i ] with open ( tp , 'r' ) as fh : lines = [ ] for line in fh : if line . startswith ( '(InitialTransformParametersFileName' ) : continue lines . append ( line ) previous_tp_str = '(InitialTransformParametersFileName "{}")' . format ( initial_tp ) lines . insert ( 0 , previous_tp_str + '\n' ) with open ( tp , 'w' ) as wh : for line in lines : wh . write ( line )
Add the initial paramter file paths to the tform files
We don't use this now as all the transforms are merged into one by elastix
Add the initial paramter file paths to the tform files We don ' t use this now as all the transforms are merged into one by elastix
"""
    Add the initial paramter file paths to the tform files
    We don't use this now as all the transforms are merged into one by elastix
    :return:
    """ # Cannot have initial tform file as we need at least 2
None
tforms
List