netstim / leaddbs

Lead-DBS is a MATLAB toolbox facilitating deep brain stimulation electrode localization and connectomic neuroimaging.
https://www.lead-dbs.org
Other
93 stars 98 forks source link

[BUG]: THOMAS docker call broken #1172

Closed tfoutz99 closed 6 months ago

tfoutz99 commented 6 months ago

When calling ea_thomas.m, it crashes when trying to pull a docker image.
Click on tools -> run thomas Windows Matlab R2023b Lead-DBS 3.1 downloaded from website

I had to change: ea_checkDocker('dockerImage'); to: ea_checkDocker(dockerImage);

to get docker to pull the repo. However, it still crashes with not being able to open the working directory:

Running THOMAS segmentation...

docker: Error response from daemon: the working directory 'C:\Users\tomfo\local\local-leaddbs\leaddbs\derivatives\leaddbs\sub-pt002\thomas' is invalid, it needs to be an absolute path.
See 'docker run --help'.
Warning: Escaped character '\B' is not valid. See 'doc sprintf' for supported special characters. 
> In ea_thomas (line 61)
In ea_thomas_menu (line 34)
In ea_menu_initmenu>@(~,~)ea_thomas_menu(handles) (line 47)
In matlab.ui.internal.controller/WebMenuController/fireMenuSelectedEvent (line 85)
In matlab.ui.internal.controller/WebMenuController/handleEvent (line 55)
In matlab.ui.internal.controller.WebMenuController>@(varargin)obj.handleEvent(varargin{:}) (line 36)
In viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 79) 
Building atlas table...
tfoutz99 commented 6 months ago

I think I got it to work. it's because of the windows paths. I added this line to convert windows paths to docker compatible paths:

if ispc
    % Convert windows paths to Docker format
    imageFolder = convertPathToDockerFormat(imageFolder);
end

using this function on my path:

function dockerPath = convertPathToDockerFormat(windowsPath)
% Extract the drive letter and convert it to lowercase
driveLetter = lower(windowsPath(1));

% Remove the colon and replace backslashes with forward slashes
dockerPath = strrep(windowsPath(3:end), '\', '/');

% Prepend the drive letter in Docker's expected format
dockerPath = ['/', driveLetter, dockerPath];
end
ningfei commented 6 months ago

Thanks for reporting. Should be fixed in bf49250b.

tfoutz99 commented 1 month ago

It's still broken on Windows; brand new install using code from Git Hub. I still get the following error:

** Process done.
Segment pre-op FGATIR image...
docker found: C:\Program Files\Docker\Docker\resources\bin\docker

Pulling docker image...
invalid reference format: repository name (library/dockerImage) must be lowercase

Running THOMAS segmentation...

docker: Error response from daemon: the working directory 'Y:\XXXXXXX\sub-pt016\thomas' is invalid, it needs to be an absolute path.
See 'docker run --help'.
Warning: Escaped character '\B' is not valid. See 'doc sprintf' for supported special characters. 
> In ea_thomas (line 61)
In ea_thomas_menu (line 34)
In ea_menu_initmenu>@(~,~)ea_thomas_menu(handles) (line 47)
In matlab.ui.internal.controller/WebMenuController/fireMenuSelectedEvent (line 85)
In matlab.ui.internal.controller/WebMenuController/handleEvent (line 55)
In matlab.ui.internal.controller.WebMenuController>@(varargin)obj.handleEvent(varargin{:}) (line 36)
In viewmodel.internal.factory.ManagerFactoryProducer>@(src,event)callback(src,viewmodel.internal.factory.ManagerFactoryProducer.convertStructToEventData(event)) (line 79) 
Building atlas table...
>> 

My edits from above still fix the issue, though.