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

[brainbrowser] Add possibility to read nii.gz files with BB #5314

Merged
merged 1 commit into from
Oct 28, 2019

Conversation

cmadjar
Copy link
Collaborator

@cmadjar cmadjar commented Oct 10, 2019

Brief summary of changes

nii.gz files could not be opened with the brainbrowser module. This PR modifies the way we read the image so that if the file is gzipped, it is decompressed first before reading the content of the file.

@cmadjar cmadjar added the Category: Bug PR or issue that aims to report or fix a bug label Oct 10, 2019
@cmadjar cmadjar requested review from driusan and johnsaigle October 10, 2019 19:15
@@ -53,7 +53,7 @@
header('Content-Type: application/x-mnc');
}
header('X-FileID: ' . $_REQUEST['file_id']);
readfile($image_path);
readgzfile($image_path);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to break 1. minc and 2. non-gzipped .nii files?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driusan Should not. File that are not in gz format are read as is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driusan as @PapillonMcGill mentioned, .mnc and .nii files can still be open with BB. I tested it before sending the PR :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driusan

readgzfile() can be used to read a file which is not in gzip format; in this case readgzfile() will directly read from the file without decompression.

https://www.php.net/manual/en/function.readgzfile.php

Copy link
Collaborator

@driusan driusan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see previous comment

@cmadjar
Copy link
Collaborator Author

cmadjar commented Oct 28, 2019

@driusan Just in case I retested it to make sure .mnc and .nii could still be open and that modification does not modify the behaviour of bb for those file types. So all good :).

@driusan driusan merged commit 2d3e5c4 into aces:minor Oct 28, 2019
@ridz1208 ridz1208 modified the milestones: 21.1.0, 22.0.0 Oct 30, 2019
@cmadjar cmadjar deleted the open_nii.gz_in_bb branch September 24, 2021 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug PR or issue that aims to report or fix a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants