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

Incorrect output and log file paths when input image is in the current directory and output file is not specified #70

Closed
bluerose73 opened this issue Jun 20, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@bluerose73
Copy link

Bug Description

The program "dw" generates incorrect output and log file paths under the following conditions:

  • The input image is located in the current directory and we don't prefix it with .\
  • The output file is not specified.

Steps to Reproduce

OS: Windows 11

cd demo
dw_bw --resxy 130 --resz 300 --lambda 461 --NA 1.45 --ni 1.512 PSF_dapi.tif --overwrite --nslice 79
dw --iter 20 dapi_001.tif PSF_dapi.tif --overwrite --noplan

Result:

In release mode

2024-06-20T09:17:16
> Settings:
image:  dapi_001.tif
psf:    PSF_dapi.tif
output: \dw_dapi_001.tif
log file: \dw_dapi_001.tif.log.txt
nIter:  20
nThreads for FFT: 10
nThreads for OMP: 10
verbosity: 1
background level: auto
method: Scaled Heavy Ball (SHB)
metric: Idiv
Stopping after 20 iterations
overwrite: YES
tiling: OFF
XY crop factor: 0.001000
Offset: 5.000000
Output Format: 16 bit integer
Scaling: Automatic
Border Quality: 2 Minimal boundary artifacts
FFT lookahead: 0
FFTW3 plan: FFTW_ESTIMATE (--noplan)
Initial guess: Flat average
deconwolf: '0.4.2'
BUILD_DATE: 'Jun 20 2024'
TIFF Backend: 'LIBTIFF, Version 4.6.0
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.'
OpenMP: YES
OpenCL: YES
VkFFT: YES

Then the program exits.

In debug mode

Assertion failed: s->log != NULL, file C:\PATH_TO_REPO\deconwolf\src\dw.c, line 1983

It seems the program can't create the log file because it doesn't have permission to write in the root directory.

Cause

The program incorrectly constructs the output file path by concatenating the input image directory (which is empty when the image is in the current directory), a path separator, and the output file name. As a result, the output path begins with a path separator \, leading to the root directory.

@elgw
Copy link
Owner

elgw commented Jun 20, 2024

Hello,

Thank you for the very clear bug report!

Looks like something that can be fixed :) Planned for next week.

Cheers,
Erik

@elgw elgw added the bug Something isn't working label Jun 20, 2024
@elgw elgw self-assigned this Jun 20, 2024
elgw added a commit that referenced this issue Jun 22, 2024
Prevent addition of '\' for files in the current folder on windows
elgw added a commit that referenced this issue Jun 22, 2024
@elgw
Copy link
Owner

elgw commented Jun 22, 2024

Hello,

The issue should be solved with the latest version. Thanks again for reporting!

Cheers,
Erik

Details

The programmer wasn't aware of all the pitfalls under windows and naively/lazily tried to re-use as much of the linux code as possible. From now on files are prefixed by a combination of _makepath and _splitpath.

@bluerose73
Copy link
Author

Hi, I can confirm that the issue is solved on my machine. Thank you for the prompt fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants