Skip to content

NHP fMRIVolume#372

Open
TakJim wants to merge 40 commits intoWashington-University:masterfrom
RIKEN-BCIL:NHPUnifiedFMRIVolume
Open

NHP fMRIVolume#372
TakJim wants to merge 40 commits intoWashington-University:masterfrom
RIKEN-BCIL:NHPUnifiedFMRIVolume

Conversation

@TakJim
Copy link
Copy Markdown
Contributor

@TakJim TakJim commented Dec 15, 2025

This PR applies fMRIVolume to NHP data.

Some additional modifications are still required. The parts that I have not been able to address yet are listed below.

TODO

  • In GenericfMRIVolumeProcessingPipelineBatchNHP.sh, accept arguments via opts_AddMandatory / opts_AddOptional
  • In BatchNHP.sh, reorganize the parameters defined in hcppipe_conf.txt and allow users to specify them directly within BatchNHP.sh
  • Apply the IsLongitudinal=TRUE processing logic to PipelineBatchNHP.sh

@glasserm glasserm self-requested a review December 15, 2025 14:39
Copy link
Copy Markdown
Contributor

@glasserm glasserm left a comment

Choose a reason for hiding this comment

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

My overall comment is that I think we should properly merge the NHP changes in to the fMRIVolume pipeline rather than bifurcate the pipelines. There is a lot of reused code between fMRIVolume and the BBR code and these are not really a completely separate process like they were for FreeSurferNHP. On initial review the changes to one step resampling and motion correction looked okay.

Comment thread fMRIVolume/GenericfMRIVolumeProcessingPipelineNHP.sh Outdated
@TakJim
Copy link
Copy Markdown
Contributor Author

TakJim commented Dec 23, 2025

@glasserm
#372 (review)

Thank you for the comment — that makes sense.

To confirm, should
fMRIVolume/scripts/DistortionCorrectionAndEPIToT1wReg_FLIRTBBRAndFreeSurferBBRbasedNHP.sh
also be combined into the main DistortionCorrectionAndEPIToT1wReg_FLIRTBBRAndFreeSurferBBRbased.sh, rather than being kept as an NHP-specific variant?

After discussing with @takuya-hayashi, we felt that this script includes quite a lot of NHP-specific logic.
I’d appreciate your thoughts on whether it should still be merged or kept separate.

@glasserm
Copy link
Copy Markdown
Contributor

@glasserm #372 (review)

Thank you for the comment — that makes sense.

To confirm, should fMRIVolume/scripts/DistortionCorrectionAndEPIToT1wReg_FLIRTBBRAndFreeSurferBBRbasedNHP.sh also be combined into the main DistortionCorrectionAndEPIToT1wReg_FLIRTBBRAndFreeSurferBBRbased.sh, rather than being kept as an NHP-specific variant?

After discussing with @takuya-hayashi, we felt that this script includes quite a lot of NHP-specific logic. I’d appreciate your thoughts on whether it should still be merged or kept separate.

Yes please.

Comment thread fMRIVolume/GenericfMRIVolumeProcessingPipelineNHP.sh Outdated
Comment thread fMRIVolume/GenericfMRIVolumeProcessingPipeline.sh Outdated
Comment thread Examples/Scripts/GenericfMRIVolumeProcessingPipelineBatchNHP.sh Outdated
Comment thread fMRIVolume/scripts/MotionCorrection.sh Outdated
Comment thread Examples/Scripts/GenericfMRIVolumeProcessingPipelineBatchNHP.sh Outdated
Comment thread Examples/Scripts/GenericfMRIVolumeProcessingPipelineBatchNHP.sh Outdated
Comment thread Examples/Scripts/GenericfMRIVolumeProcessingPipelineBatchNHP.sh Outdated
Comment thread Examples/Scripts/GenericfMRIVolumeProcessingPipelineBatchNHP.sh Outdated
Comment thread Examples/Scripts/GenericfMRIVolumeProcessingPipelineBatchNHP.sh Outdated
Comment thread fMRIVolume/GenericfMRIVolumeProcessingPipeline.sh Outdated
Comment thread fMRIVolume/scripts/OneStepResampling.sh Outdated
Comment thread fMRIVolume/scripts/OneStepResampling.sh Outdated
Comment thread fMRIVolume/GenericfMRIVolumeProcessingPipeline.sh Outdated
Comment thread fMRIVolume/GenericfMRIVolumeProcessingPipeline.sh Outdated
Comment thread fMRIVolume/GenericfMRIVolumeProcessingPipeline.sh Outdated
TakJim added 21 commits April 13, 2026 16:19
- Update jacobian comment: "handled below, and is optional" (r2772048473)
- Fix typo "filed" -> "field" (r2772049269)
- Remove empty else clause (r2772057701)
- Invert Human check to != Human pattern in OneStepResampling.sh (r2772060840)
- Add --species argument to DistortionCorrection script (r2776907266)
- Derive betspecieslabel from SPECIES when not set (r2776912100)
- Pass --species=${SPECIES} from pipeline to DistortionCorrection call
- Fix pre-existing syntax: [ && ] -> [[ && ]], missing space before ],
  missing fi for DistortionCorrection != SPIN_ECHO block
- Fix ${10}/${11} positional parameter expansion in MotionCorrection.sh
- Fix IsLongitudinal condition that always evaluated False
- Add --species option to OneStepResampling.sh
- Delete unused GenericfMRIVolumeMotionCorrectXRunsNHP.sh
- Rename --bbr/BBR to --bbr-contrast/BBRContrast for clarity
- Fix jacobian comment in human code path, remove in NONE path
- Use (( ! IsLongitudinal )) syntax in DistortionCorrection script
- Restructure OneStepResampling.sh: full else for human/nonhuman
- Revert multi-echo code changes: restore else clause, remove duplicate
Complete the reversion of echo array changes that was flagged as
incomplete in PR Washington-University#372 review comments r2853580713 and r2853593232.
… @ parsing

- Add StructRes, isFLAIR, isT1wDivFLAIR variables
- Pass --structres to SetUpSPECIES.sh, pass args to SetUpFSNHP.sh
- Remove unnecessary @-delimiter stripping from session variables
@TakJim TakJim force-pushed the NHPUnifiedFMRIVolume branch from 3755989 to 926a14c Compare April 13, 2026 07:19
@TakJim
Copy link
Copy Markdown
Contributor Author

TakJim commented Apr 13, 2026

Rebased onto current master (a2f3e5f3). 38 commits, no conflicts. Diff contains only fMRIVolume-related files (no master changes leaked).

TakJim added 2 commits April 13, 2026 17:25
- Move Jacobian/registration/warpfield/SEBASED code (was shared) into
  the else # for Human block in TOPUP case
- Move UseJacobian+BiasField block into else # Human block in BBR section
- Delete old NHP stub log messages replaced by new NHP processing
# These are set by SetUpSPECIES.sh (sourced after EnvironmentScript).
# Override here only if you need non-default values for your dataset.
# Example values for Macaque:
# FinalFMRIResolution="1.25"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
# FinalFMRIResolution="1.25"
# FinalfMRIResolution="1.25"

change to match SetUpSpecies.sh

#CorticalScaleFactor="1" # Cortical scale factor
#
#### fMRIVolume-relevant variables
#FinalFMRIResolution="2" # Target final resolution of fMRI data in mm
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#FinalFMRIResolution="2" # Target final resolution of fMRI data in mm
#FinalfMRIResolution="2" # Target final resolution of fMRI data in mm

change to match SetUpSpecies.sh

--echospacing="$DwellTime" \
--echodiff="$DeltaTE" \
--unwarpdir="$UnwarpDir" \
--fmrires="$FinalFMRIResolution" \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
--fmrires="$FinalFMRIResolution" \
--fmrires="$FinalfMRIResolution" \

change to match SetUpSpecies.sh

--echospacing=$DwellTime \
--echodiff=$DeltaTE \
--unwarpdir=$UnwarpDir \
--fmrires=$FinalFMRIResolution \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
--fmrires=$FinalFMRIResolution \
--fmrires=$FinalfMRIResolution \

change to match SetUpSpecies.sh

# Scaling brain size to adapt to size dependency of mcflirt - TH 2024
if [[ ! -z "$BrainScaleFactor" && ! $(echo "$BrainScaleFactor == 1" | bc) = 1 ]] ; then
log_Msg "Scaling brain with a factor = $BrainScaleFactor"
${HCPPIPEDIR_Global}/ScaleVolume.sh ${Scout}.nii.gz ${BrainScaleFactor} ${WorkingDirectory}/scout_scale.nii.gz ${WorkingDirectory}/scale.world.mat
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
${HCPPIPEDIR_Global}/ScaleVolume.sh ${Scout}.nii.gz ${BrainScaleFactor} ${WorkingDirectory}/scout_scale.nii.gz ${WorkingDirectory}/scale.world.mat
${HCPPIPEDIR_Global}/ScaleVolumeNHP.sh ${Scout}.nii.gz ${BrainScaleFactor} ${WorkingDirectory}/scout_scale.nii.gz ${WorkingDirectory}/scale.world.mat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants