Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapting Connectomemapper for Windows 10 #220

Open
IsottaR opened this issue Dec 2, 2022 · 4 comments
Open

Adapting Connectomemapper for Windows 10 #220

IsottaR opened this issue Dec 2, 2022 · 4 comments
Labels
Brainhack22! Brainhack Global Geneva 2022 Tasks

Comments

@IsottaR
Copy link

IsottaR commented Dec 2, 2022

In principle the CMP works for Windows but there are problems concerning:

  1. update user documentation to install CMP on Windows

  2. CMP commandline docker integration
    2.1 os.geteuid needs to be manually set to your machine ID (os.geteuid does not exsist for Windows)

  3. CMPbidsapp manager
    3.1 installation of cmp GUI
    3.2 rendering of images in GUI
    3.3 cmp command line does not run in interactive mode (docker -it)

@jwirsich
Copy link
Collaborator

jwirsich commented Dec 2, 2022

Workaround for 3.2 (Images of Button cannot be loaded):

Drop

(border-image: url({image}) 0 0 0 0;)

in util.py in function return_button_style_sheet

Buttons will be replaced with Text of the Item name which works also with Win10.

Edit:
Final solution: Enforce Posix Path Format of background color URL

border-image: url({Path(image).as_posix()}) 0 0 0 0;)

@IsottaR
Copy link
Author

IsottaR commented Dec 2, 2022

2.1 OS.GETEUID DOES NOT EXIST FOR WINDOWS
To use CMP from command line:
In cmp/cli/connectomemapper3_docker.py, substitute line 56 (cmd += '-u $(id -u):$(id -g) ') with:
cmd += '-u 1000:1000'

To use the GUI:
In bidsappmanager/gui/bidsapp.py, substitute line 820 (cmd.append(f"{os.geteuid()}:{os.getegid()}") with: cmd.append("1000:1000")

(1000 seems to be a common ID. Doublecheck the ID of your machine typing id in WSL terminal)

3.1 INSTALLATION OF CMP GUI

Download Anaconda for Windows:

Create the conda environment (modified from https://raw.githubusercontent.com/connectomicslab/connectomemapper3/master/conda/environment.yml) using the CMPenvironment.txt file (convert it into .yml) : CMPenvironment.txt
conda env create -f path2downloaded_env\CMPenvironment.yml

Activate the environment:
conda activate py39cmp-gui

Manually install the following:

pip install nibabel==3.2.2 –user
pip install matplotlib==3.5.2 nipype==1.8.0 traitsui==7.2.0 duecredit==0.9.1 mne==0.24.1 mne_connectivity==0.3 datalad[full]==0.17.2 datalad-container==1.1.6 datalad-neuroimaging==0.3.1 pybids==0.14.0 statsmodels==0.13.1 networkx==2.6.3 pydicom==2.2.2 pycartool==0.1.1
pip install obspy

Manually install MRtrix via: https://www.mrtrix.org/download/windows-msys2/

Manually install git-annex via: https://git-annex.branchable.com/install/Windows/ (download .exe file)

Install the cmp :
pip install connectomemapper

3.3 CMP COMMAND LINE NOT RUNNING IN INTERACTIVE MODE

In bidsappmanager/gui/bidsapp.py, substitute line 799 ("docker", "run", "-it", "--rm") with:
"docker", "run", "-i", "--rm"

@jwirsich
Copy link
Collaborator

jwirsich commented Dec 3, 2022

2.1 OS.GETEUID DOES NOT EXIST FOR WINDOWS

'-u uid' option seems to be unecessary for the docker call, I propose to delete

@IsottaR
Copy link
Author

IsottaR commented Dec 3, 2022

To visualize results:

in cmtk/util.py, substitute line 422 (dict_outputs = json.loads("{}".format(str_outputs))) with:
dict_outputs =fix_JSON("{}".format(str_outputs))

and add the function:

def fix_JSON(json_message=None):
    result = None
    try:
        result = json.loads(json_message)
    except Exception as e:
        indexs = [i for i, char in enumerate(json_message) if char == "\\"]

        temp = list(json_message)

        for idx in indexs:
            temp[idx] = '/'
        new_message = ''.join(temp)
        return fix_JSON(json_message=new_message)
    return result

@sebastientourbier sebastientourbier added the Brainhack22! Brainhack Global Geneva 2022 Tasks label Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Brainhack22! Brainhack Global Geneva 2022 Tasks
Projects
None yet
Development

No branches or pull requests

3 participants