|
13 | 13 | # |
14 | 14 | # For more details, see http://www.mrtrix.org/. |
15 | 15 |
|
16 | | -import json, os, shutil |
| 16 | +import json, os, shutil, sys |
17 | 17 | from mrtrix3 import MRtrixError |
18 | 18 | from mrtrix3 import app, image, matrix, path, run |
19 | 19 | from .contrasts import Contrasts |
@@ -608,7 +608,10 @@ def execute(): #pylint: disable=unused-variable |
608 | 608 | transform_average_driftref = matrix.load_transform('linear_transform_average_init.txt') |
609 | 609 |
|
610 | 610 | def linear_msg(): |
611 | | - return f'Optimising template with linear registration (stage {level+1} of {len(linear_scales)}; {regtype})' |
| 611 | + return 'Optimising template with linear registration' \ |
| 612 | + + (f' (stage {level+1} of {len(linear_scales)}; {regtype})' \ |
| 613 | + if sys.stderr.isatty \ |
| 614 | + else f' ({len(linear_scales)} stages)') |
612 | 615 | progress = app.ProgressBar(linear_msg, len(linear_scales) * len(ins) * (1 + n_contrasts + int(use_masks))) |
613 | 616 | for level, (regtype, scale, niter, lmax) in enumerate(zip(linear_type, linear_scales, linear_niter, linear_lmax)): |
614 | 617 | for inp in ins: |
@@ -808,7 +811,10 @@ def linear_msg(): |
808 | 811 | os.mkdir('warps') |
809 | 812 | level = 0 |
810 | 813 | def nonlinear_msg(): |
811 | | - return f'Optimising template with non-linear registration (stage {level+1} of {len(nl_scales)})' |
| 814 | + return 'Optimising template with non-linear registration' \ |
| 815 | + + (f' (stage {level+1} of {len(nl_scales)})' \ |
| 816 | + if sys.stderr.isatty \ |
| 817 | + else f' ({len(nl_scales)} stages)') |
812 | 818 | progress = app.ProgressBar(nonlinear_msg, len(nl_scales) * len(ins)) |
813 | 819 | for level, (scale, niter, lmax) in enumerate(zip(nl_scales, nl_niter, nl_lmax)): |
814 | 820 | for inp in ins: |
|
0 commit comments