bbfrederick / rapidtide

rapidtide - a suite of programs for doing time lag correlation analysis on fMRI data
Apache License 2.0
75 stars 14 forks source link

--norefinedespeckled timeshift applied to negative number of voxels #78

Closed robbwh closed 2 years ago

robbwh commented 2 years ago

When using the argument --norefinedespeckled

Rapidtide tries to apply the timeshift to a negative number of voxels and refinement fails.

Percent complete: [############################################################] 100.00%refinement failed - terminating at end of pass 1
rereading /data/h_vmac/ahmedha/cvr_despike/data/234873/080/reactivity_preproc/epi_folder/mc_stc_despike_taskBlock_234873_epi.nii.gz to calculate mean value, please wait
done

performing pca refinement with pcacomponents set to 0.8
Using  7  component(s), accounting for  81.40% of the variance
pca/avg correlation =  -1.0

Timeshift applied to -14136 voxels, 21209 used for refinement: 
     410476  locationfails 
     380532  ampfails 
     179507  lagfails 
     409757  sigmafails

Is that just indicating most of my voxels are being despeckled? I'm confused why the number of voxels would be negative.

Thanks and sorry for two posts in such quick succession.

bbfrederick commented 2 years ago

Uh, whoops? That didn't show up in testing. I'll look at it tomorrow. Probably don't use that for the time being - using the despeckled voxels in refinement is the default (and previous) behavior.

robbwh commented 2 years ago

Okay, thank you.

The reason I tried that argument was because when I used rapidtide 2.1.0 (docker container)

showtc output_desc-refinedmovingregressor_timeseries.json

Looked more like I expected it to.

Screen Shot 2022-03-14 at 10 17 20 AM

But using the newest version 2.2.0 it looked (maybe) not as good

Screen Shot 2022-03-14 at 10 17 51 AM

I used the exact same arguments for both runs (with the exception of rapidtide version):

/usr/local/miniconda/bin/rapidtide \
    /data/h_vmac/ahmedha/cvr_despike/data/233403/013/reactivity_preproc/epi_folder/mc_stc_despike_taskBlock_233403_epi.nii.gz \
    /scratch/Hudson/rapidAnalysis/rtoutputs/outCVR/rt_feb16_22/233403_2/output \
    --delaymapping \
    --pickleft \
    --noglm \
    --numnull 0 \
    --searchrange -25 100 \
    --nofitfilt \
    --nprocs=11 \
    --oversampfac 5 \
    --spatialfilt 1.05 \
    --filterfreqs 0.005 0.05 \
    --corrmask=/scratch/Hudson/rapidAnalysis/rtoutputs/outCVR/rt_feb16_22/233403_2/233403_mask.nii.gz \
    --detrendorder=2 \
    --zeropadding -1 \
    --globalmeaninclude=/scratch/Hudson/rapidAnalysis/preproc/gmmasks/cvr/gmInBold/233403seg.nii.gz \
    --ampthresh 0.4 \
    --interptype=cubic
bbfrederick commented 2 years ago

Looking at your output, I think the real error was that refinement failed because there were no voxels in the mask when despeckled voxels were excluded. I've pushed a new version that checks for that condition, and backs off on excluding despeckled voxels for that pass if it would result in no voxels for refinement. I also fixed the issue that was causing Docker images not to build, so you can use the "latest" docker version of rapidtide if that's your normal workflow.

robbwh commented 2 years ago

sounds good, thanks!