Mouse-Imaging-Centre / RMINC

Statistics for MINC volumes: A library to integrate voxel-based statistics for MINC volumes into the R environment. Supports getting and writing of MINC volumes, running voxel-wise linear models, correlations, etc.; correcting for multiple comparisons using the False Discovery Rate, and more. With contributions from Jason Lerch, Chris Hammill, Jim Nikelski and Matthijs van Eede. Some additional information can be found here:
https://mouse-imaging-centre.github.io/RMINC
Other
22 stars 17 forks source link

mincMean, mincSd, perhaps other voxel summary functions segfault when given >2 groupings #241

Open nzxwang opened 5 years ago

nzxwang commented 5 years ago
> gfs %>% select(Group, log_full_det)
# A tibble: 55 x 2
   Group       log_full_det                                                    
   <chr>       <chr>                                                           
 1 Male_TCDD   Basson_TCDD_processed/1.1L_coil15_distcorr/stats-volumes/1.1L_c…
 2 Male_TCDD   Basson_TCDD_processed/1.3_coil1_distcorr/stats-volumes/1.3_coil…
 3 Male_TCDD   Basson_TCDD_processed/1.4_coil5_distcorr/stats-volumes/1.4_coil…
 4 Male_TCDD   Basson_TCDD_processed/1.5_coil10_distcorr/stats-volumes/1.5_coi…
 5 Male_TCDD   Basson_TCDD_processed/1.7_coil15_distcorr/stats-volumes/1.7_coi…
 6 Male_TCDD   Basson_TCDD_processed/2.3_coil9_distcorr/stats-volumes/2.3_coil…
 7 Female_TCDD Basson_TCDD_processed/2.4_coil4_distcorr/stats-volumes/2.4_coil…
 8 Male_TCDD   Basson_TCDD_processed/2.5_coil8_distcorr/stats-volumes/2.5_coil…
 9 Male_TCDD   Basson_TCDD_processed/2.6_coil6_distcorr/stats-volumes/2.6_coil…
10 Male_TCDD   Basson_TCDD_processed/2.7_coil9_distcorr/stats-volumes/2.7_coil…
# ... with 45 more rows
> mean <- mincMean(gfs$log_full_det, grouping=gfs$Group)
Method: mean
Number of volumes: 55
Volume sizes: 241 478 315
N GROUPS: 1.000000
In slice 
 0 
 *** caught segfault ***
address 0xfffffffe0f524220, cause 'memory not mapped'

Traceback:
 1: mincSummary(filenames, grouping, mask, method = "mean", maskval = maskval)
 2: mincMean(gfs$log_full_det, grouping = gfs$Group)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 
cfhammill commented 5 years ago

A: does it work on two groups? B: Work around gfs %>% group_by(group) %>% summarize(means = list(mincMean(log_full_det, Group)))

nzxwang commented 5 years ago

A: works on two groups. B: thank you for the elegant solution. I came up with a less elegant solution of gfs %>% filter(Sex == "Male")

cfhammill commented 5 years ago

I personally am not a big fan of the grouping option, especially when partitioning your data and mapping over the partitions is so simple (especially in the new glorious tidy future).

bcdarwin commented 5 years ago

Agree with Chris, so I am somewhat surprised by your proposal in #240.

cfhammill commented 5 years ago

240 is a different kettle of fish. If you subset the tree prior to analysis it is not necessarily a tree any longer and can't be processed with the same code.