Problem with smoothing

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

This topic contains 19 replies, has 2 voices, and was last updated by  Anand Joshi 2 years, 5 months ago.

  • Author
  • #886


    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

    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/ /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

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

  • #888


    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

    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


    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

    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


    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?





  • #893

    Anand Joshi

    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


    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
    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:
    Traceback (most recent call last):
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/”, line 215, in main
    status =, args)
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/”, line 342, in run
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/”, line 778, in install
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/”, line 754, in uninstall
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/”, line 115, in remove
    renames(path, new_path)
    File “/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/”, line 267, in renames
    shutil.move(old, new)
    File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/”, line 302, in move
    copy2(src, real_dst)
    File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/”, line 131, in copy2
    copystat(src, dst)
    File “/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/”, 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

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

    Thank you sooo much for your help.

  • #896


    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)


  • #899

    Anand Joshi

    For smoothing volumetrically, you can use

    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: 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


    Could you please give me an example?

    Something like this?

    /Applications/BrainSuite17a/svreg/bin/ /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 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 for nii.gz volume files, and for .dfs files for surface based smoothing.

  • #909


    I receive always 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)


    I tried std values from 0.5 till 5 but without any success.

    Is it the .svreg.inv.jacobian.nii.gz file the right one to perform smoothing?

    Is there a path-example to understand how will it be used?

    Thanks a lot.

  • #910


    After trying some things out, the last problem that comes out is the following:

    Warning: qform is already set. Nothing to do.
    > In add_qform (line 69)
    In load_nii_BIG_Lab (line 47)
    In svreg_smooth_vol_function (line 34)
    Error using imgaussfilt3
    Expected Sigma to be finite.

    Error in imgaussfilt3>validateSigma (line 379)

    Error in imgaussfilt3>parseInputs (line 343)

    Error in imgaussfilt3 (line 113)

    Error in svreg_smooth_vol_function (line 46)


    What does it mean?

  • #911

    Anand Joshi

    What’s the command line that you tried?

  • #912


    /Applications/BrainSuite17a/svreg/bin/ /Users/leonidastra86/Desktop/ABC/Pre/sample1001/Normalised/1001.svreg.inv.jacobian.nii.gz std2 std2 std2 /Users/leonidastra86/Desktop/ABC/Pre/sample1001/Normalised/

  • #913

    Anand Joshi

    Instead of std2 try just 2

  • #914


    Warning: qform is already set. Nothing to do.
    > In add_qform (line 69)
    In load_nii_BIG_Lab (line 47)
    In svreg_smooth_vol_function (line 34)

  • #915

    Anand Joshi

    You can ignore the warning. The output should be correct.

You must be logged in to reply to this topic.