Refactor dwi2response brain mask derivation with shell subsets#3383
Merged
Conversation
Resolve a conflict in dwi2response between restricting response function estimation to a subset of shells and deriving a brain mask. Previously, when a shell subset was requested (or the chosen algorithm operates on a single shell) and no mask was supplied, dwi2mask was run on the already shell-filtered data. The command now imports the whole DWI series, derives the mask from all available data, and only then extracts the requested shells for response function estimation; when a mask is provided, the subset continues to be extracted directly on import. A paragraph is added to the command documentation explaining this behaviour and noting that, to mask from the same subset, the user should either supply that subset as input or provide a mask generated from it. Session prompts: 1. > Python command dwi2response currently contains a conflict regarding the use of a subset of shells for response function estimation vs. derivation of a brain mask. If either the user specifies that they wish to compute response functions for only a subset of shells, or an algorithm nominates that it can only operate on a single b>0 shell---possibly including the b=0 shell also---then this filtering will be applied at initial import of data into the scratch directory. If this imported image is then used to derive a brain mask, because the user did not provide one themselves, then the derivation of that mask will be performed using only that particular subset of shells. The command is to be refactored as follows. > 1. If the user specifies a subset of shells, but does not provide a mask: > 1.1. The whole input DWI series will be imported into the scratch directory. > 1.2. Command dwi2mask will be executed on this complete DWI series. > 1.3. The user-requested subset of shells will be extracted using dwiextract; app.cleanup() can then be executed on the initial imported DWI. > 1.4. The requested dwi2response algorithm is executed taking as input the shell-filtered DWI. > 2. If the user specifies a subset of shells, but also provides a mask: > 2.1. The input DWI series will be filtered using dwiextract immediately upon import. > 2.2. THe requested dwi2response algorithm is executed taking this DWI series as input. > A paragraph shall be added to the command documentation describing that in the absence of a user-specified mask, the whole DWI series will be used for brain mask derivation; if the user wishes for the same subset of shells used for response function estimation to also be used for brain mask estimation, then they should generate that subset using eg. the dwiextract command and then provide that result as the input to dwi2response. Generated-by: Claude Opus 4.8 <noreply@anthropic.com>
|
clang-tidy review says "All clean, LGTM! 👍" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2963.