|
12 | 12 | import numpy as np |
13 | 13 | import nibabel as nib |
14 | 14 |
|
15 | | -from nibabel.affines import apply_affine |
16 | 15 | from nibabel.openers import Opener |
17 | 16 | from nibabel.py3k import asbytes, asstr |
18 | 17 | from nibabel.volumeutils import (native_code, swapped_code) |
@@ -791,19 +790,23 @@ def __str__(self): |
791 | 790 | hdr_field = getattr(Field, attr) |
792 | 791 | if hdr_field in vars: |
793 | 792 | vars[attr] = vars[hdr_field] |
794 | | - vars['scalar_names'] = '\n'.join(map(asstr, vars['scalar_name'])) |
795 | | - vars['property_names'] = "\n".join(map(asstr, vars['property_name'])) |
| 793 | + vars['scalar_names'] = '\n '.join([asstr(s) |
| 794 | + for s in vars['scalar_name'] |
| 795 | + if len(s) > 0]) |
| 796 | + vars['property_names'] = "\n ".join([asstr(s) |
| 797 | + for s in vars['property_name'] |
| 798 | + if len(s) > 0]) |
796 | 799 | return """\ |
797 | 800 | MAGIC NUMBER: {MAGIC_NUMBER} |
798 | 801 | v.{version} |
799 | 802 | dim: {DIMENSIONS} |
800 | 803 | voxel_sizes: {VOXEL_SIZES} |
801 | 804 | orgin: {ORIGIN} |
802 | 805 | nb_scalars: {NB_SCALARS_PER_POINT} |
803 | | -scalar_name:\n {scalar_names} |
| 806 | +scalar_name:\n {scalar_names} |
804 | 807 | nb_properties: {NB_PROPERTIES_PER_STREAMLINE} |
805 | | -property_name:\n {property_names} |
806 | | -vox_to_world: {VOXEL_TO_RASMM} |
| 808 | +property_name:\n {property_names} |
| 809 | +vox_to_world:\n{VOXEL_TO_RASMM} |
807 | 810 | voxel_order: {VOXEL_ORDER} |
808 | 811 | image_orientation_patient: {image_orientation_patient} |
809 | 812 | pad1: {pad1} |
|
0 commit comments