Problem with smoothing

Forums Forums Surface and Volume Registration (SVReg) Problem with smoothing

This topic contains 12 replies, has 2 voices, and was last updated by  Anand Joshi 5 hours, 37 minutes ago.

  • Author
    Posts
  • #886

    leonidastra86
    Participant

    I try to smooth my data in order to use it in the bss tool. Unfortunately, I receive the whole time the following message:

    cannot read (and the directory of my files ..xxx.pvc-thickness_0-6mm.smooth2.0mm.left.mid.cortex.dfs

    Error in svreg_smooth_surf_function (line 40)

    I run macOS Sierra in Macbook pro. The first idea was that svreg is blocked from the firewall so I fixed it. The problem, however, remains the same.

    Any ideas?

    PS: I suppose the problem is again in the directory that I give in Terminal ->/Applications/BrainSuite17a/svreg/bin/svreg_smooth_surf_function.sh /Users/leonidastra86/Desktop/AAA/Pre/xxx/Normalised/abc.pvc-thickness_0-6mm.left.mid.cortex.dfs /Users/leonidastra86/Desktop/AAA/Pre/xxx/Normalised/abc.pvc-thickness_0-6mm.smooth2.0mm.left.mid.cortex.dfs 2.0

  • #887

    Anand Joshi
    Moderator

    Can you check if the input files exist by typing ls <filename> exactly as in the input command?

  • #888

    leonidastra86
    Participant

    Should I type it in terminal? Because I don’t get anything out of it.

    The input file (/Users/leonidastra86/Desktop/AAA/Pre/xxx/Normalised/abc.pvc-thickness_0-6mm.left.mid.cortex.dfs) exists for sure, I use the path as always. Should I use the atlas.pvc-thickness_0-6mm.left.mid.cortex.dfs maybe? Because in this case I receive an additional error:##Error using readdfs (line 61)

    I apologise for my poor knowledge on programming.

  • #889

    Anand Joshi
    Moderator

    can you try the following in the terminal
    ls /Users/leonidastra86/Desktop/AAA/Pre/xxx/Normalised/abc.pvc-thickness_0-6mm.left.mid.cortex.dfs

    Is there any space in the path? If yes, then you should use double quotes around the file name.

  • #890

    leonidastra86
    Participant

    There is no space in my path. When I type your suggested path I receive the same back without the ls.
    Is it normal?

    Thank you so much for your help. It is really important for me to manage the statistical analysis of my results.

  • #891

    Anand Joshi
    Moderator

    I read your command, I think you are specifying 2 files as inputs.
    There should be 3 files. If you are smoothing cortical thickness, then you should specify the input file twice and then the output file.
    first file contains geometry
    second file contains the function that needs to be smoothed
    third file if the output file
    fourth argument is the amount of smoothing.

    If that doesn’t work, can you share one file with me using dropbox and share the exact command that you are trying so that I can try to reproduce the error?

  • #892

    leonidastra86
    Participant

    It worked! That was the problem! I had the input file just once. I did it twice and worked.

    Thank you sooooo much!

    The right file is the one with the patient name or the one with atlas?

    abc.pvc-thickness_0-6mm.left.mid.cortex.dfs

    or

    atlas.pvc-thickness_0-6mm.left.mid.cortex.dfs

    ???

  • #893

    Anand Joshi
    Moderator

    subject file contains cortical thickness on the subject’s surface whereas
    atlas file contains subjects cortical thickness coregistered to the atlas.
    If you want to perform multisubject or across scan comparison then you can use atlas file as input, whereas if you want to look at only one scan then you can use the subject file.

  • #894

    leonidastra86
    Participant

    Perfect! So far so good. I smoothed both hemispheres and wanted to start the analysis. My demographics file is ready, however I cannot install BSS. I already installed R and R Studio but as soon as I type pip install bss I receive the following problem:

    Leonidass-Air:~ leonidastra86$ pip install bss
    Collecting bss
    Using cached bss-0.9.4-py2.py3-none-any.whl
    Collecting matplotlib>=1.5.3 (from bss)
    Downloading matplotlib-2.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (13.2MB)
    100% |████████████████████████████████| 13.2MB 89kB/s
    Collecting numpy>=1.11 (from bss)
    Using cached numpy-1.13.3-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
    Collecting statsmodels>=0.6.1 (from bss)
    Using cached statsmodels-0.8.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
    Collecting patsy>=0.4 (from bss)
    Using cached patsy-0.4.1-py2.py3-none-any.whl
    Collecting scipy>=0.18 (from bss)
    Using cached scipy-0.19.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
    Collecting nibabel>=2.1 (from bss)
    Using cached nibabel-2.1.0.zip
    Collecting pandas>=0.19 (from bss)
    Using cached pandas-0.20.3-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
    Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib>=1.5.3->bss)
    Requirement already satisfied: pytz in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib>=1.5.3->bss)
    Collecting backports.functools-lru-cache (from matplotlib>=1.5.3->bss)
    Downloading backports.functools_lru_cache-1.4-py2.py3-none-any.whl
    Collecting six>=1.10 (from matplotlib>=1.5.3->bss)
    Using cached six-1.11.0-py2.py3-none-any.whl
    Collecting cycler>=0.10 (from matplotlib>=1.5.3->bss)
    Using cached cycler-0.10.0-py2.py3-none-any.whl
    Collecting subprocess32 (from matplotlib>=1.5.3->bss)
    Using cached subprocess32-3.2.7.tar.gz
    Collecting python-dateutil>=2.0 (from matplotlib>=1.5.3->bss)
    Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 2.0MB/s
    Installing collected packages: numpy, backports.functools-lru-cache, six, cycler, subprocess32, python-dateutil, matplotlib, scipy, patsy, pandas, statsmodels, nibabel, bss
    Found existing installation: numpy 1.8.0rc1
    DEPRECATION: Uninstalling a distutils installed project (numpy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling numpy-1.8.0rc1:
    Exception:
    Traceback (most recent call last):
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py”, line 215, in main
    status = self.run(options, args)
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py”, line 342, in run
    prefix=options.prefix_path,
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py”, line 778, in install
    requirement.uninstall(auto_confirm=True)
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py”, line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py”, line 115, in remove
    renames(path, new_path)
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py”, line 267, in renames
    shutil.move(old, new)
    File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 302, in move
    copy2(src, real_dst)
    File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 131, in copy2
    copystat(src, dst)
    File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py”, line 103, in copystat
    os.chflags(dst, st.st_flags)
    OSError: [Errno 1] Operation not permitted: ‘/var/folders/13/mblgc8t52kx3g229dsds97r00000gn/T/pip-szRNjk-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info’

    As far as I understand it will be installed and afterwards deinstalled. Why?

    And one more question, in the USC2015_Brainsuite Workshop there is one more smoothed file in every patient folder, the ABCS.svreg.inv.map.jacdet.smooth2.0mm.nii.gz.

    Should I smooth it too? Is it important for the analysis?

    Thank you sooo much for your help.

  • #896

    leonidastra86
    Participant

    In the slides for BSS, on the required data, says that we need a svreg.inv.jacobian.*mm.nii.gz file. Should I smooth it too?

    If yes, how? Because with the way I did the other files doesn’t work. I receive the following message:

    Index exceeds matrix dimensions.

    Error in readdfsGz>readdfs (line 129)

    Error in readdfsGz (line 41)

    Error in svreg_smooth_surf_function (line 31)

    MATLAB:badsubscript

  • #899

    Anand Joshi
    Moderator

    For smoothing volumetrically, you can use
    svreg_smooth_vol_function.sh

    Please type it on the command line without any arguments to see the usage.

    svreg_smooth_vol_function : This script performs 3d vol news
    Authored by Anand A. Joshi, Signal and Image Processing Institute
    Department of Electrical Engineering, Viterbi School of Engineering, USC

    usage: svreg_smooth_vol_function.sh in_file stdx stdy stdz out_file

    required input:
    in_file: input vol file
    stdx,stdy,stdz: std dev (in mm) in 3 directions
    out_vol: output vol file

  • #907

    leonidastra86
    Participant

    Could you please give me an example?

    Something like this?

    /Applications/BrainSuite17a/svreg/bin/svreg_smooth_surf_function.sh /Users/leonidastra86/Desktop/ABC/Pre/XXX/Normalised/abt.svreg.inv.jacobian.nii.gz stdx stdy stdz /Users/leonidastra86/Desktop/ABC/Pre/XXX/Normalised/abt.svreg.inv.jacobian.smooth2.0mm.nii.gz 2.0

    How do I define the std values? What are they exactly?

  • #908

    Anand Joshi
    Moderator

    svreg_smooth_vol_function.sh uses 3D Gaussian smoothing. The parameters specify standard deviation, in mm, of the Gaussian kernel for the smoothing. One can specify the std dev in three directions separately.
    Please make sure to svreg_smooth_vol_function.sh for nii.gz volume files, and svreg_smooth_surf_function.sh for .dfs files for surface based smoothing.

You must be logged in to reply to this topic.