nipy / mindboggle

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

nbpapaya not working in jupyter notebook tutorial #116

Closed binarybottle closed 7 years ago

binarybottle commented 7 years ago

@akeshavan --

nbpapaya's Overlay is giving an error in our jupyter notebook tutorial.
Here is the code:

import os
import pandas as pd
from nbpapaya import Overlay

df = pd.DataFrame(depths, columns=["depth"])
df.to_csv('depths.csv', index=False)

def getMeshOpts(vtk_file, csv_file, vmin, vmax, threshold):
    cols = pd.read_csv(csv_file).columns.tolist()
    MeshOpts = {}
    MeshOpts[os.path.abspath(vtk_file)] = {  
                      "filename": os.path.abspath(csv_file),
                      "colormin": "#0000FF", 
                      "colormax": "#FF0000",
                      "vmin": vmin,
                      "vmax": vmax,
                      "key": cols[0],
                      "key_options": cols,    
                      "threshold": threshold,
                      "mesh_transparency": 1,
                      "mesh_visible": True,
                      "overlay_transparency": 1
                  }
    return MeshOpts

MeshOpts = getMeshOpts(surface_file, "depths.csv" , 2,10,2)
Overlay(MeshOpts)

And here is the resulting error:

doing checks /home/jovyan/.jupyter/custom/ FileNotFoundError Traceback (most recent call last)

in () 25 26 MeshOpts = getMeshOpts(surface_file, "depths.csv" , 2,10,2) ---> 27 Overlay(MeshOpts) /opt/conda/lib/python3.5/site-packages/nbpapaya/base.py in __init__(self, image_options, num, options, width, height, host) 360 # width, height, host) 361 super(Overlay, self).__init__(fnames, num, options, image_options, --> 362 width, height) 363 new_mapper = {} 364 print(self._mapper) /opt/conda/lib/python3.5/site-packages/nbpapaya/base.py in __init__(self, fnames, num, options, image_options, width, height) 86 # papaya.css templates are in the right spot. papaya_data is used by 87 # _symlink_files ---> 88 self._do_checks() 89 90 # symlink our files to a place where the viewer can access it /opt/conda/lib/python3.5/site-packages/nbpapaya/base.py in _do_checks(self) 28 if not os.path.exists(os.path.join(self.home_dir,"papaya.js")): 29 shutil.copyfile(os.path.join(os.path.split(__file__)[0],"Papaya/release/current/standard/papaya.js"), ---> 30 os.path.join(self.home_dir,"papaya.js")) 31 32 if not os.path.exists(os.path.join(self.home_dir,"papaya.css")): /opt/conda/lib/python3.5/shutil.py in copyfile(src, dst, follow_symlinks) 112 os.symlink(os.readlink(src), dst) 113 else: --> 114 with open(src, 'rb') as fsrc: 115 with open(dst, 'wb') as fdst: 116 copyfileobj(fsrc, fdst) FileNotFoundError: [Errno 2] No such file or directory: '/opt/conda/lib/python3.5/site-packages/nbpapaya/Papaya/release/current/standard/papaya.js'

Could it be due to the difference in installations below?:

In the Dockerfile.mindboggle.complete file, nbpapaya is installed here:

USER $NB_USER
WORKDIR /opt
RUN conda install -y flask && \
    git clone https://github.com/akeshavan/roygbiv && \
    cd /opt/roygbiv && \
    git checkout fbbf31c29952d0ea22ed05d98e0a5a7e7d0827f9 && \
    python setup.py install && \
    cd /opt && \
    git clone https://github.com/akeshavan/nbpapaya && \
    cd /opt/nbpapaya && \
    git checkout 60119b6e1de651f250af26a3541d9cb18e971526 && \
    python setup.py install && \
    rm -rf /opt/roygbiv /opt/nbpapaya

whereas in our original MIT nipype workshop tutorial, you installed nbpapaya as follows:

RUN git clone https://github.com/akeshavan/nbpapaya && cd nbpapaya && git submodule update --init --recursive && python setup.py install

binarybottle commented 7 years ago

Fixed -- Just needed to add the line git submodule update --init --recursive after git checkout.