Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Harmonization of multi-site imaging data with ComBat (Python)

License

NotificationsYou must be signed in to change notification settings

Jfortin1/neuroCombat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MITVersionPythonVersion

This is the maintained and official version of neuroCombat (previously hostedhere) introduced in ourour recent paper.

Installation

neuroCombat is hosted on PyPI, and the easiest way to install neuroCombat is to use thepip command:

pip install neuroCombat

Usage

TheneuroCombat function performs harmonization

fromneuroCombatimportneuroCombatimportpandasaspdimportnumpyasnp# Getting example data# 200 rows (features) and 10 columns (scans)data=np.genfromtxt('testdata/testdata.csv',delimiter=",",skip_header=1)# Specifying the batch (scanner variable) as well as a biological covariate to preserve:covars= {'batch':[1,1,1,1,1,2,2,2,2,2],'gender':[1,2,1,2,1,2,1,2,1,2]}covars=pd.DataFrame(covars)# To specify names of the variables that are categorical:categorical_cols= ['gender']# To specify the name of the variable that encodes for the scanner/batch covariate:batch_col='batch'#Harmonization step:data_combat=neuroCombat(dat=data,covars=covars,batch_col=batch_col,categorical_cols=categorical_cols)["data"]

Optional arguments

  • eb :True orFalse. Should Empirical Bayes be performed? IfFalse, the harmonization model will be fit for each feature separately. This is equivalent to performing a location/shift (L/S) correction to each feature separately (no information pooling across features).

  • parametric :True orFalse. Should parametric adjustements be performed?True by default.

  • mean_only :True orFalse. Should only be means adjusted (no scaling)?False by default

  • ref_batch : batch name to be used as the reference batch for harmonization.None by default, in which case the average across scans/images/sites is taken as the reference batch.

Output

Since version 0.2.10, theneuroCombat function outputs a dictionary with 3 elements:

  • data: A numpy array of the harmonized data, with the same dimension (shape) as the input data.
  • estimates: A dictionary of the neuroCombat estimates; useful for visualization and understand scanner effects.
  • info: A dictionary of the inputs needed for ComBat harmonization (batch/scanner information, etc.)

To simply return the harmonized data, one can use the following:

data_combat = neuroCombat(dat=dat, ...)["data"]

where... are the user-specified arguments needed for harmonization.


[8]ページ先頭

©2009-2025 Movatter.jp