Repository: nipy/nipype

Issue:
Mrtrix3 `dwi2response` - bad algorithm argument position
### Summary

Th Mrtrix3 `dwi2response` CL wrapper generates the following runtime error:
```shell
dwi2response:
mrinfo: [ERROR] no diffusion encoding information found in image "<DWI_FILE>"
dwi2response: [ERROR] Script requires diffusion gradient table: either in image header, or using -grad / -fslgrad option
```
It turns out that the command generated by `nipype` does not respect (my version of) the Mrtrix3 CL format.

### Actual behavior

Generated command (not runnable):
```shell
dwi2response -fslgrad <BVEC_FILE> <BVAL_FILE> -mask <MASK_FILE> tournier <WM_FILE>
```

### Expected behavior

Runnable command:
```shell
dwi2response tournier -fslgrad <BVEC_FILE> <BVAL_FILE> -mask <MASK_FILE> <WM_FILE>
```

### Environment

- `MRtrix 3.0_RC2-117-gf098f097    dwi2response     bin version: 3.0_RC2-117-gf098f097`
- `Python 2.7.12`
- `nipype v1.0.0`
 

### Quick and dirty solution

I'm really not sure how clean it is, but it worked for me; in the `ResponseSDInputSpec` class, I changed `position=-6` to `position=1` in the `algorithm` traits.



Comments:

Patch:
diff --git a/doc/_templates/gse.html b/doc/_templates/gse.html
index 1f0f0557d..25f13feb1 100644
--- a/doc/_templates/gse.html
+++ b/doc/_templates/gse.html
@@ -24,20 +24,17 @@
 </style>
 
 <div class="sidebarblock">
-    <div id="cse-search-form">Loading</div>
-
-    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
-    <script type="text/javascript">
-        google.load('search', '1', {language : 'en'});
-        google.setOnLoadCallback(function() {
-            var customSearchControl = new google.search.CustomSearchControl(
-                    '010960497803984932957:u8pmqf7fdoq');
-
-            customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
-            var options = new google.search.DrawOptions();
-            options.enableSearchboxOnly("{{pathto('searchresults')}}");
-            customSearchControl.draw('cse-search-form', options);
-        }, true);
+    <script>
+      (function() {
+        var cx = '010960497803984932957:u8pmqf7fdoq';
+        var gcse = document.createElement('script');
+        gcse.type = 'text/javascript';
+        gcse.async = true;
+        gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
+        var s = document.getElementsByTagName('script')[0];
+        s.parentNode.insertBefore(gcse, s);
+      })();
     </script>
+    <gcse:search></gcse:search>
 </div>
 {% endblock %}
diff --git a/doc/conf.py b/doc/conf.py
index 9891454e6..144c36f0d 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -73,7 +73,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'nipype'
-copyright = u'2009-17, Neuroimaging in Python team'
+copyright = u'2009-18, Neuroimaging in Python team'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
diff --git a/doc/searchresults.rst b/doc/searchresults.rst
index bef389467..d79eaebfb 100644
--- a/doc/searchresults.rst
+++ b/doc/searchresults.rst
@@ -6,168 +6,17 @@ Search results
 
 .. raw:: html
 
-   <div id="cse" style="width: 100%;">Loading</div>
-    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
-    <script type="text/javascript">
-      function parseQueryFromUrl () {
-        var queryParamName = "q";
-        var search = window.location.search.substr(1);
-        var parts = search.split('&');
-        for (var i = 0; i < parts.length; i++) {
-          var keyvaluepair = parts[i].split('=');
-          if (decodeURIComponent(keyvaluepair[0]) == queryParamName) {
-            return decodeURIComponent(keyvaluepair[1].replace(/\+/g, ' '));
-          }
-        }
-        return '';
-      }
-      google.load('search', '1', {language : 'en', style : google.loader.themes.MINIMALIST});
-      google.setOnLoadCallback(function() {
-        var customSearchControl = new google.search.CustomSearchControl(
-                '010960497803984932957:u8pmqf7fdoq');
-
-        customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
-        customSearchControl.draw('cse');
-        var queryFromUrl = parseQueryFromUrl();
-        if (queryFromUrl) {
-          customSearchControl.execute(queryFromUrl);
-        }
-      }, true);
-    </script>
-    <link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css" type="text/css" /> <style type="text/css">
-      .gsc-control-cse {
-        font-family: Arial, sans-serif;
-        border-color: #FFFFFF;
-        background-color: #FFFFFF;
-      }
-      input.gsc-input {
-        border-color: #BCCDF0;
-      }
-      input.gsc-search-button {
-        border-color: #666666;
-        background-color: #CECECE;
-      }
-      .gsc-tabHeader.gsc-tabhInactive {
-        border-color: #E9E9E9;
-        background-color: #E9E9E9;
-      }
-      .gsc-tabHeader.gsc-tabhActive {
-        border-top-color: #FF9900;
-        border-left-color: #E9E9E9;
-        border-right-color: #E9E9E9;
-        background-color: #FFFFFF;
-      }
-      .gsc-tabsArea {
-        border-color: #E9E9E9;
-      }
-      .gsc-webResult.gsc-result,
-      .gsc-results .gsc-imageResult {
-        border-color: #FFFFFF;
-        background-color: #FFFFFF;
-      }
-      .gsc-webResult.gsc-result:hover,
-      .gsc-imageResult:hover {
-        border-color: #FFFFFF;
-        background-color: #FFFFFF;
-      }
-      .gs-webResult.gs-result a.gs-title:link,
-      .gs-webResult.gs-result a.gs-title:link b,
-      .gs-imageResult a.gs-title:link,
-      .gs-imageResult a.gs-title:link b {
-        color: #0000CC;
-      }
-      .gs-webResult.gs-result a.gs-title:visited,
-      .gs-webResult.gs-result a.gs-title:visited b,
-      .gs-imageResult a.gs-title:visited,
-      .gs-imageResult a.gs-title:visited b {
-        color: #0000CC;
-      }
-      .gs-webResult.gs-result a.gs-title:hover,
-      .gs-webResult.gs-result a.gs-title:hover b,
-      .gs-imageResult a.gs-title:hover,
-      .gs-imageResult a.gs-title:hover b {
-        color: #0000CC;
-      }
-      .gs-webResult.gs-result a.gs-title:active,
-      .gs-webResult.gs-result a.gs-title:active b,
-      .gs-imageResult a.gs-title:active,
-      .gs-imageResult a.gs-title:active b {
-        color: #0000CC;
-      }
-      .gsc-cursor-page {
-        color: #0000CC;
-      }
-      a.gsc-trailing-more-results:link {
-        color: #0000CC;
-      }
-      .gs-webResult .gs-snippet,
-      .gs-imageResult .gs-snippet,
-      .gs-fileFormatType {
-        color: #000000;
-      }
-      .gs-webResult div.gs-visibleUrl,
-      .gs-imageResult div.gs-visibleUrl {
-        color: #008000;
-      }
-      .gs-webResult div.gs-visibleUrl-short {
-        color: #008000;
-      }
-      .gs-webResult div.gs-visibleUrl-short {
-        display: none;
-      }
-      .gs-webResult div.gs-visibleUrl-long {
-        display: block;
-      }
-      .gsc-cursor-box {
-        border-color: #FFFFFF;
-      }
-      .gsc-results .gsc-cursor-box .gsc-cursor-page {
-        border-color: #E9E9E9;
-        background-color: #FFFFFF;
-        color: #0000CC;
-      }
-      .gsc-results .gsc-cursor-box .gsc-cursor-current-page {
-        border-color: #FF9900;
-        background-color: #FFFFFF;
-        color: #0000CC;
-      }
-      .gs-promotion {
-        border-color: #336699;
-        background-color: #FFFFFF;
-      }
-      .gs-promotion a.gs-title:link,
-      .gs-promotion a.gs-title:link *,
-      .gs-promotion .gs-snippet a:link {
-        color: #0000CC;
-      }
-      .gs-promotion a.gs-title:visited,
-      .gs-promotion a.gs-title:visited *,
-      .gs-promotion .gs-snippet a:visited {
-        color: #0000CC;
-      }
-      .gs-promotion a.gs-title:hover,
-      .gs-promotion a.gs-title:hover *,
-      .gs-promotion .gs-snippet a:hover {
-        color: #0000CC;
-      }
-      .gs-promotion a.gs-title:active,
-      .gs-promotion a.gs-title:active *,
-      .gs-promotion .gs-snippet a:active {
-        color: #0000CC;
-      }
-      .gs-promotion .gs-snippet,
-      .gs-promotion .gs-title .gs-promotion-title-right,
-      .gs-promotion .gs-title .gs-promotion-title-right *  {
-        color: #000000;
-      }
-      .gs-promotion .gs-visibleUrl,
-      .gs-promotion .gs-visibleUrl-short {
-        color: #008000;
-      }
-      /* Manually added - the layout goes wrong without this */
-      .gsc-tabsArea,
-      .gsc-webResult:after,
-      .gsc-resultsHeader {
-         clear: none;
-      }
-    </style>
+   <div id="cse" style="width: 100%;">Loading
+   <script>
+     (function() {
+       var cx = '010960497803984932957:u8pmqf7fdoq';
+       var gcse = document.createElement('script');
+       gcse.type = 'text/javascript';
+       gcse.async = true;
+       gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
+       var s = document.getElementsByTagName('script')[0];
+       s.parentNode.insertBefore(gcse, s);
+     })();
+   </script>
+   <gcse:search></gcse:search>
+   </div>
diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py
index ca5996bea..740513194 100644
--- a/nipype/interfaces/mrtrix3/preprocess.py
+++ b/nipype/interfaces/mrtrix3/preprocess.py
@@ -27,7 +27,7 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec):
         'tournier',
         'tax',
         argstr='%s',
-        position=-6,
+        position=1,
         mandatory=True,
         desc='response estimation algorithm (multi-tissue)')
     in_file = File(
@@ -74,7 +74,7 @@ class ResponseSD(MRTrix3Base):
     >>> resp.inputs.algorithm = 'tournier'
     >>> resp.inputs.grad_fsl = ('bvecs', 'bvals')
     >>> resp.cmdline                               # doctest: +ELLIPSIS
-    'dwi2response -fslgrad bvecs bvals tournier dwi.mif wm.txt'
+    'dwi2response tournier -fslgrad bvecs bvals dwi.mif wm.txt'
     >>> resp.run()                                 # doctest: +SKIP
     """
 


Test patch:
diff --git a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py
index 29a89f097..01104d2d2 100644
--- a/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py
+++ b/nipype/interfaces/mrtrix3/tests/test_auto_ResponseSD.py
@@ -8,7 +8,7 @@ def test_ResponseSD_inputs():
         algorithm=dict(
             argstr='%s',
             mandatory=True,
-            position=-6,
+            position=1,
         ),
         args=dict(argstr='%s', ),
         bval_scale=dict(argstr='-bvalue_scaling %s', ),