Problem with smoothing

Viewing 18 reply threads
  • Author
    Posts
    • #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.

                            • #909
                              leonidastra86
                              Participant

                                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)

                                MATLAB:badsubscript

                                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
                                leonidastra86
                                Participant

                                  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)

                                  MATLAB:imgaussfilt3:expectedFinite

                                  What does it mean?

                                • #911
                                  Anand Joshi
                                  Moderator

                                    What’s the command line that you tried?

                                  • #912
                                    leonidastra86
                                    Participant

                                      /Applications/BrainSuite17a/svreg/bin/svreg_smooth_vol_function.sh /Users/leonidastra86/Desktop/ABC/Pre/sample1001/Normalised/1001.svreg.inv.jacobian.nii.gz std2 std2 std2 /Users/leonidastra86/Desktop/ABC/Pre/sample1001/Normalised/1001.svreg.inv.map.jacdet.smooth2.0mm.nii.gz

                                    • #913
                                      Anand Joshi
                                      Moderator

                                        Instead of std2 try just 2

                                      • #914
                                        leonidastra86
                                        Participant

                                          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
                                          Moderator

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

                                        Viewing 18 reply threads
                                        • You must be logged in to reply to this topic.