Hi Joe,

The problem is this: the input dataset is stored in single precision, not 
double. Internally PALM converts the test statistic (t in this case) to z-stat. 
There are many reasons for doing the transformation: to correct across 
contrasts and design matrices that have different degrees of freedom and to put 
all spatial statistics into a common scale (and here you indeed use TFCE). This 
happens regardless of whether the user chooses the option -zstat or not. If the 
user uses -zstat, the test statistic will be saved as z-stat, otherwise it will 
be saved as the original statistic, but internally it's always z-stat.

This particular input file is stored using single precision, and this is kept 
throughout. That is, PALM doesn't internally convert the inputs to double -- 
what if the user actually wants single precision to, e.g., save memory or allow 
for a large dataset? To further complicate matters in this case, here we are 
testing the mean, and some voxels (4853, precisely) have an average signal 
compared to their variance that is high to the point of going over the limit 
that would allow conversion to a z-stat without overflowing the single 
precision limit.

Take the first voxel with this issue (voxel index 7): it has a test statistic t 
= -21.1164818 (all decimal places included). The df of the numerator is 1 
(t-test) and of the denominator is 216. Then:


>> palm_gtoz(single(-21.1164818), 1, 216)
ans =
   -Inf

But if it were double, we would find the correct result, that is not infinite:


>> palm_gtoz(double(-21.1164818), 1, 216)
ans =
  -15.536373937167403

So, to fix this, convert the input file to double precision and it should work. 
Another option is to edit the file palm_miscread.m, and add a new line right 
after line 304 containing:

X.data = double(X.data);

Hope this solves the issue!

All the best,

Anderson


From: Joseph Orr <joseph....@tamu.edu>
Date: Wednesday, July 25, 2018 at 10:28
To: "Winkler, Anderson (NIH/NIMH) [E]" <anderson.wink...@nih.gov>
Cc: HCP Users <hcp-users@humanconnectome.org>
Subject: Re: [HCP-Users] issues with palm tfce for HCP task func data

Thanks Anderson - I tried seed set to 1 and 'twist' and both resulted in the 
same error.

Joe

--
Joseph M. Orr, Ph.D.
Assistant Professor
Department of Psychological and Brain Sciences
Texas A&M Institute for Neuroscience
Texas A&M University
College Station, TX

On Mon, Jul 23, 2018 at 9:55 PM, Winkler, Anderson (NIH/NIMH) [E] 
<anderson.wink...@nih.gov<mailto:anderson.wink...@nih.gov>> wrote:
Hi Joseph,

I downloaded your files earlier today but couldn’t yet have a look.

It may be that the particular values in the permutation distribution caused the 
tail fitting to fail (simply an unlucky scenario). If that is the case, try 
running again with a different seed (there is an option for that, see among the 
advanced options). The default is 0, so try with a different number (e.g., 1, 
2, ...).

All the best,

Anderson


Sent from mobile. Please excuse brevity.
________________________________
From: Joseph Orr <joseph....@tamu.edu<mailto:joseph....@tamu.edu>>
Sent: Monday, July 23, 2018 7:59:26 PM
To: HCP Users
Subject: Re: [HCP-Users] issues with palm tfce for HCP task func data

I inserted a breakpoint in palm_competitive at line 104 right before the error 
(pasted below) occurred. In the first pass. dpv_tstat_fwep, tfce_tstat, and 
tfce_tstat_uncp are saved (now in the folder linked above), but when i 
continue, I get the NaN error. The vector dd is length n-permutation - 1, and 
has a single NaN in row 2499. The workspace at the time of the error is saved 
as post_tfce_uncorrp_workspace.mat in the linked folder.

100% [Design 1/1, Contrast 1/1, Shuffling 2500/2500, Modality 1/1]
Elapsed time with permutations: ~ 4438.79 seconds.
Computing p-values.
Saving p-values (uncorrected, and corrected within modality and within 
contrast).
Saving file: motor_RH_results_L_test_dpv_tstat_uncp
104     if any(isnan(dd)),
Saving file: motor_RH_results_L_test_dpv_tstat_fwep
Saving file: motor_RH_results_L_test_tfce_tstat
Saving file: motor_RH_results_L_test_tfce_tstat_uncp
K>> any(isnan(dd))

ans =

  logical

   1

K>> sum(isnan(dd))

ans =

     1

Error using palm_competitive (line 105)
Data cannot be sorted. Check for NaNs that might be present,
or precision issues that may cause over/underflow.
If you are using "-approx tail", consider adding "-nouncorrected".

Error in palm_datapval (line 67)
    [~,cdfG,distp] = palm_competitive(Gvals(:),'descend',true);

Error in palm_saveall (line 303)
                            Ptosave =
                            
palm_datapval(plm.Gtfce{y}{m}{c},plm.Gtfcemax{y}{m}{c},false);

Error in palm_core (line 2489)
palm_saveall(plm,opts);

Error in palm (line 81)
palm_core(varargin{:});

--
Joseph M. Orr, Ph.D.
Assistant Professor
Department of Psychological and Brain Sciences
Texas A&M Institute for Neuroscience
Texas A&M University
College Station, TX

On Mon, Jul 23, 2018 at 3:27 PM, Joseph Orr 
<joseph....@tamu.edu<mailto:joseph....@tamu.edu>> wrote:
I'm having an issue running palm following the CIFTI example 
(https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM/Examples#Example_10:_Using_CIFTI_files<https://urldefense.proofpoint.com/v2/url?u=https-3A__fsl.fmrib.ox.ac.uk_fsl_fslwiki_PALM_Examples-23Example-5F10-3A-5FUsing-5FCIFTI-5Ffiles&d=DwMF-g&c=ODFT-G5SujMiGrKuoJJjVg&r=ZKy1VO33u0kvO-PqY1gpb9Ld-AGhtT8c9PAcpsEyp70&m=RaviqUi2wUI0iRi8KmuXK6qfq6njkV8BCJLflU-UzvM&s=5jdHn9UVkGwcsjlZ9THOxLwYV1FFETS2_XSGDwG-0N4&e=>).
 I've worked with PALM a lot, but this is the first time using CIFTI files. I 
am analyzing several functional tasks from 219 participants in the HCP. I'm 
running a one-sample t-test with two covariates. The subcortical statistics run 
fine, but I am having issues with the cortical surfaces.

I was running 10000 permutations and after completing the permutations the job 
would stall for 10+ hours. When I tried running less (e.g., 500) permutations I 
get an error from palm_competitive about NaNs. The dpv fwe-corrected stats save 
(and look reasonable), so the NaN appears during the tfce stage. For the 
surface I'm using: 
HCP_S1200_GroupAvg_v1/S1200.R.midthickness_MSMAll.32k_fs_LR.surf.gii along with 
the mean surface vertex area of the 219 participants. Inspecting the data in 
wb_view I don't see anything unusual, and no Inf/NaN are indicated in 
wb_command -file-infomation.

Here are the options I am using (I've tried toggling accel, nouncorrected, and 
logp in different combinations, but the results are always the same):
-i lang_story-math_data_L.func.gi<http://lang_story-math_data_L.func.gi>i
-d design_n219_mean.mat
-t design_n219_mean.con
-o lang_story-math_data_L_cort
-T
-tfce2D
-s L_midthickness.surf.gii L_area.func.gii
-logp
-n 10000
-ise

The relevant files for one example are available here: 
https://drive.google.com/drive/folders/1uZPQK6Gy2MtTuOjZwin0ZToxBSUN9tct?usp=sharing<https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_drive_folders_1uZPQK6Gy2MtTuOjZwin0ZToxBSUN9tct-3Fusp-3Dsharing&d=DwMF-g&c=ODFT-G5SujMiGrKuoJJjVg&r=ZKy1VO33u0kvO-PqY1gpb9Ld-AGhtT8c9PAcpsEyp70&m=RaviqUi2wUI0iRi8KmuXK6qfq6njkV8BCJLflU-UzvM&s=q91SdqtP5f9zbWfpbdaTy3-OUhKsnArcuolWz3jUdC0&e=>

I've checked everything that I can think of to troubleshoot the issue, but I've 
hit a wall, so I'd be grateful for any advise/insights. The last thing I'm 
trying is using the sphere surface, and I'll update if that works.


Joe

--
Joseph M. Orr, Ph.D.
Assistant Professor
Department of Psychological and Brain Sciences
Texas A&M Institute for Neuroscience
Texas A&M University
College Station, TX


_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org<mailto:HCP-Users@humanconnectome.org>
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org<mailto:HCP-Users@humanconnectome.org>
http://lists.humanconnectome.org/mailman/listinfo/hcp-users


_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

Reply via email to