nipy / mindboggle

Automated anatomical brain label/shape analysis software (+ website)
http://mindboggle.info
Other
143 stars 54 forks source link

New UnicodeEncodeError in pipeline (--thickinthehead) #200

Closed DMAlessandro closed 4 years ago

DMAlessandro commented 4 years ago

Hello,

I'm using the docker container of the latest release and while it seems to work on the examples, while testing mindboggle on my data I get UnicodeEncodeError. I saw in other issues you then solved it with another version to the Dockerfile,here are the errors that I get. On different subjects I get different errors when using Mindboggle with Freesurfer, ANTs, and specifying --thickinthehead (if I do not call thickinthehead flag, it works smoothly).

The ones following, are crashes I receive from running different subjects with the same command "mindboggle $FREESURFER_SUBJECT --ants $ANTS_SUBJECT --out $OUT --thickinthehead"

1)

Traceback (most recent call last):
  File "/opt/miniconda-latest/envs/mb/bin/mindboggle", line 2412, in <module>
    mbFlow.run(plugin=args.plugin)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/workflows.py", line 599, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 53, in run
    crashfile = report_crash(node)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/plugins/tools.py", line 72, in report_crash
    crash2txt(crashfile, dict(node=node, traceback=traceback))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/utils/filemanip.py", line 760, in crash2txt
    fp.write('Node inputs:\n{}\n'.format(node.inputs))
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 503: ordinal not in range(128)

2)

200502-17:48:13,809 nipype.workflow ERROR:
         Node Thickness_per_freesurfer_cortex_label failed to run on host 3e160e9c5c74.
200502-17:48:13,811 nipype.workflow ERROR:
         Saving crash info to /home/jovyan/work/104/crash-20200502-174813-root-Thickness_per_freesurfer_cortex_label-9281ff91-bbb1-4829-b5b8-5aa0e7af386c.txt
Traceback (most recent call last):
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 48, in run
    node.run(updatehash=updatehash)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 474, in run
    write_node_report(self, is_mapnode=isinstance(self, MapNode))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 140, in write_node_report
    report_file.write_text('\n'.join(lines))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/pathlib.py", line 1216, in write_text
    return f.write(data)
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 818: ordinal not in range(128)

When creating this crashfile, the results file corresponding
to the node could not be found.
/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/scipy/ndimage/interpolation.py:478: UserWarning: The behaviour of affine_transform with a one-dimensional array supplied for the matrix parameter has changed in scipy 0.18.0.
  "The behaviour of affine_transform with a one-dimensional "
Traceback (most recent call last):
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 48, in run
    node.run(updatehash=updatehash)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 474, in run
    write_node_report(self, is_mapnode=isinstance(self, MapNode))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 140, in write_node_report
    report_file.write_text('\n'.join(lines))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/pathlib.py", line 1216, in write_text
    return f.write(data)
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 818: ordinal not in range(128)

3)

Traceback (most recent call last):
  File "/opt/miniconda-latest/envs/mb/bin/mindboggle", line 2412, in <module>
    mbFlow.run(plugin=args.plugin)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/workflows.py", line 599, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 53, in run
    crashfile = report_crash(node)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/plugins/tools.py", line 72, in report_crash
    crash2txt(crashfile, dict(node=node, traceback=traceback))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/utils/filemanip.py", line 760, in crash2txt
    fp.write('Node inputs:\n{}\n'.format(node.inputs))
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 503: ordinal not in range(128)

4)

Traceback (most recent call last):
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 48, in run
    node.run(updatehash=updatehash)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 474, in run
    write_node_report(self, is_mapnode=isinstance(self, MapNode))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 140, in write_node_report
    report_file.write_text('\n'.join(lines))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/pathlib.py", line 1216, in write_text
    return f.write(data)
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 794: ordinal not in range(128)

When creating this crashfile, the results file corresponding
to the node could not be found.
Traceback (most recent call last):
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 48, in run
    node.run(updatehash=updatehash)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/nodes.py", line 474, in run
    write_node_report(self, is_mapnode=isinstance(self, MapNode))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/utils.py", line 140, in write_node_report
    report_file.write_text('\n'.join(lines))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/pathlib.py", line 1216, in write_text
    return f.write(data)
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 794: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/miniconda-latest/envs/mb/bin/mindboggle", line 2412, in <module>
    mbFlow.run(plugin=args.plugin)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/engine/workflows.py", line 599, in run
    runner.run(execgraph, updatehash=updatehash, config=self.config)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/plugins/linear.py", line 53, in run
    crashfile = report_crash(node)
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/pipeline/plugins/tools.py", line 72, in report_crash
    crash2txt(crashfile, dict(node=node, traceback=traceback))
  File "/opt/miniconda-latest/envs/mb/lib/python3.6/site-packages/nipype/utils/filemanip.py", line 760, in crash2txt
    fp.write('Node inputs:\n{}\n'.format(node.inputs))
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 503: ordinal not in range(128)

All in all, I solved the problem temporarily in quite an un-intuitive workaround, and thought of sharing it here. So, in case others had similar problems, I divided the commands for the same subject by doing this way for each patient (in my case I was interested in thickinthehead, but noticed that it works only when specifying --nosurfaces):

locale-gen en_US.UTF-8
export LANG=en_US.UTF-8 LANGUAGE=en_US.en LC_ALL=en_US.UTF-8

mindboggle $FREESURFER_SUBJECT --ants $ANTS_SUBJECT --out $OUT --no_surfaces --thickinthehead
mindboggle $FREESURFER_SUBJECT --ants $ANTS_SUBJECT --out $OUT

Anyways, great repo, I really see noticeable improvements in the hybrid segmentation of the brains! Looking forward to your help and new updates

Thank you for your help.

binarybottle commented 4 years ago

Thank you for raising this issue, @9Alex6 !

I would warn you that I am concerned about the limitations of the thickinthehead algorithm:

I no longer list/link thickinthehead in the primary documentation for mindboggle (https://mindboggle.readthedocs.io/en/latest/) because of the above concerns, but am happy that this issue documents your findings to help others!