Package gov.nih.mipav.model.algorithms
Class fMRIBlindDeconvolution
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.fMRIBlindDeconvolution
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class fMRIBlindDeconvolution extends AlgorithmBase
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
fMRIBlindDeconvolution.ConvAndLinear
(package private) class
fMRIBlindDeconvolution.DiscretInteg
(package private) class
fMRIBlindDeconvolution.Tracker
-
Field Summary
Fields Modifier and Type Field Description private double
MAX_DELTA
private double
MIN_DELTA
Reference: Hamza Cherkaoui, Thomas Moreau, Abderrahim Halimi, Philippe Ciuciu.-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description fMRIBlindDeconvolution()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
__inf_norm(double[] x)
double[][][]
__inf_norm(double[][][] x)
double[]
_custom_padd(int[] p_total, double[] a, int min_power_of_2, int min_zero_padd, double zero_padd_ratio)
double[][]
_inf_norm(double[][][] arr, int axis)
double[][]
_inf_norm(double[][] arr, int axis)
double[]
_loops_deconv(double[] y, double[] diff_z, double[][] H, double lbda, long nb_iter, boolean early_stopping, long wind, double tol)
double[][]
_padd_assymetric(double[][] arrays, int[] p, double c, java.lang.String paddtype)
double[]
_padd_assymetric(double[] arrays, int[] p, double c, java.lang.String paddtype)
double[][]
_padd_symetric(double[][] arrays, int p, double c, java.lang.String paddtype)
double[]
_padd_symetric(double[] arrays, int p, double c, java.lang.String paddtype)
void
_test_conv_adj_fourier_hrf(double[] ai_s, double[] hrf, java.lang.String testname)
void
_test_conv_adj_toeplitz_kernel_hrf(double[] ai_s, double[] hrf, java.lang.String testname)
void
_test_conv_adj_toeplitz_kernel_signal(double[] ai_s, double[] hrf, java.lang.String testname)
void
_test_conv_fourier_kernel_hrf(double[] ai_s, double[] hrf, java.lang.String testname)
void
_test_conv_toeplitz_kernel_hrf(double[] ai_s, double[] hrf, java.lang.String testname)
void
_test_conv_toeplitz_kernel_signal(double[] ai_s, double[] hrf, java.lang.String testname)
void
_test_data(double[] noisy_ar_s, double[] ar_s, double[] ai_s, double[] i_s, double[] hrf, double[] noise, double snr, int nb_events, java.lang.String testnum)
double[][]
_unpadd_assymetric(double[][] arrays, int[] p, java.lang.String paddtype)
double[]
_unpadd_assymetric(double[] arrays, int[] p, java.lang.String paddtype)
double[][]
_unpadd_symetric(double[][] arrays, int p, java.lang.String paddtype)
double[]
_unpadd_symetric(double[] arrays, int p, java.lang.String paddtype)
void
_yield_data(double[][] noisy_ar_s, double[][] ar_s, double[][] ai_s, double[][] i_s, double[][] hrf, double[][] noise, double[] snr, int[] nb_events)
void
add_gaussian_noise(double[] noisy_signal, double[] noise, double[] signal, double snr, boolean haveSeed, long random_state)
void
bd(java.util.Vector<java.lang.Double> xout, java.util.Vector<java.lang.Double> zout, java.util.Vector<java.lang.Double> diff_zout, java.util.Vector<java.lang.Double> hout, java.util.Vector<java.lang.Double> dr, java.util.Vector<java.lang.Double> dg, java.util.Vector<java.lang.Double> dJ, double[] y, double t_r, double lbda, double theta, double[] z_0, double hrf_dur, double[] bounds, int nb_iter, int nb_sub_iter, int nb_last_iter, int print_period, boolean early_stopping, int wind, double tol, int verbose)
void
blind_deconvolution_example()
double[][]
custom_padd(int[] padd, double[][] arrays, int min_power_of_2, int min_zero_padd, double zero_padd_ratio)
void
data_generation_example()
void
deconv(double[] x, double[] z, double[] diff_z, java.util.Vector<java.lang.Double> J, java.util.Vector<java.lang.Double> R, java.util.Vector<java.lang.Double> G, double[] y, double t_r, double[] hrf, double lbda, boolean early_stopping, double tol, int wind, int nb_iter, int nb_sub_iter, int verbose)
void
deconv_example()
double
fwhm(double[] t_hrf, double[] hrf, int k)
void
gen_regular_ai_s(double[] ai_s, double[] i_s, double[] t, int dur, double tr, double dur_bloc, boolean centered)
void
gen_regular_bloc_bold(double[] noisy_ar_s, double[] ar_s, double[] ai_s, double[] i_s, double[] t, double[] noise, int dur, double tr, double dur_bloc, boolean sourcehrf, double[] hrf, double snr, boolean haveSeed, long random_state)
void
gen_rnd_ai_s(double[] ai_s, double[] i_s, double[] t, double dur, double tr, int nb_events, int avg_dur, double std_dur, boolean middle_spike, boolean overlapping, boolean unitary_block, boolean haveSeed, long random_state, int nb_try, int nb_try_duration, boolean centered)
void
gen_rnd_bloc_bold(double[] noisy_ar_s, double[] ar_s, double[] ai_s, double[] i_s, double[] t, double[] noise, double dur, double tr, boolean sourcehrf, double[] hrf, int nb_events, int avg_dur, double std_dur, boolean middle_spike, boolean overlapping, boolean unitary_block, double snr, int nb_try, int nb_try_duration, boolean centered, boolean haveSeed, long random_state)
void
gen_rnd_event_bold(double[] noisy_ar_s, double[] ar_s, double[] i_s, double[] t, double[] noise, int dur, double tr, boolean sourcehrf, double[] hrf, int nb_events, double avg_ampl, double std_ampl, double snr, boolean haveSeed, long random_state)
void
gen_rnd_i_s(double[] i_s, double[] t, int dur, double tr, int nb_events, double avg_ampl, double std_ampl, boolean haveSeed, long random_state, int nb_try, int nb_try_duration, boolean centered)
void
hrf_estim(double[] h, java.util.Vector<java.lang.Double> J, double[] z, double[] y, double t_r, double dur, int verbose)
double
hrf_fit_err(double theta, double[] z, double[] y, double t_r, double hrf_dur)
private double
inf_norm(double[] x)
private double
inf_norm(java.util.Vector<java.lang.Double> x)
double[]
irfft(double[][] x, boolean isOdd)
double
log2(double x)
double
mad(double[] x, double c)
double
mad_daub_noise_est(double[] x, double c)
double
median(double[] x)
double
norm(double[] x)
java.util.Random
random_generator(long random_state)
double[][]
rfft(double[] x)
void
runAlgorithm()
Actually runs the algorithm.double
sign(double x)
double[]
simple_convolve(double[] k, double[] x, int dim_out)
void
simple_hrf_estimation()
double[]
simple_retro_convolve(double[] k, double[] x, int dim_out)
double[]
spectral_convolve(double[] k, double[] xin)
double[]
spectral_deconvolve(double[] k, double[] x)
double
spectral_radius_est(fMRIBlindDeconvolution.ConvAndLinear L, int x_shape, int nb_iter, double tol, boolean verbose)
double[]
spectral_retro_convolve(double[] k, double[] xin)
double[]
spectral_retro_deconvolve(double[] k, double[] x)
void
spm_hrf(double[] hrf, double[] t_hrf, double delta, double t_r, double dur, boolean normalized_hrf, double dt, double p_delay, double undershoot, double p_disp, double u_disp, double p_u_ratio, double onset)
double
std(double[] x)
void
test_data_gen()
void
test_fourier_adj_convolution_kernel_hrf_on_ai_s()
void
test_fourier_adj_convolution_kernel_hrf_on_dirac()
void
test_fourier_convolution_kernel_hrf_on_ai_s()
void
test_fourier_convolution_kernel_hrf_on_dirac()
void
test_inf_norm()
void
test_integ_adj()
void
test_integ_op()
void
test_power_2_padding_length()
void
test_toeplitz_adj_convolution_kernel_hrf_on_ai_s()
void
test_toeplitz_adj_convolution_kernel_hrf_on_dirac()
void
test_toeplitz_adj_convolution_kernel_signal_on_ai_s()
void
test_toeplitz_adj_convolution_kernel_signal_on_dirac()
void
test_toeplitz_convolution_kernel_hrf_on_ai_s()
void
test_toeplitz_convolution_kernel_hrf_on_dirac()
void
test_toeplitz_convolution_kernel_signal_on_ai_s()
void
test_toeplitz_convolution_kernel_signal_on_dirac()
void
test_zero_mirror_zero_padd_unpadd()
void
test_zero_padd_unpadd()
double[][]
toeplitz_from_kernel(double[] k, int dim_in, int dim_out)
double
tp(double[] t_hrf, double[] hrf)
void
yield_blocks_signal(double[][] ai_s, double[][] hrf, double[][] alpha, double[] tr)
void
yield_diracs_signal(double[][] i_s, double[][] hrf, double[][] alpha, double[] tr)
private double
zabs(double zr, double zi)
zabs computes the absolute value or magnitude of a double precision complex variable zr + j*zi.private void
zdiv(double ar, double ai, double br, double bi, double[] cr, double[] ci)
complex divide c = a/b.-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, finalize, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
MIN_DELTA
private final double MIN_DELTA
Reference: Hamza Cherkaoui, Thomas Moreau, Abderrahim Halimi, Philippe Ciuciu. Sparsity-based blind deconvolution of neural activation signal in fMRI. IEEE-ICASSP 2019 - International Conference on Acoustics, Speech and Signal Processing, May 2019, Brighton, United Kingdom. ffhal-02085810v2- See Also:
- Constant Field Values
-
MAX_DELTA
private final double MAX_DELTA
- See Also:
- Constant Field Values
-
-
Method Detail
-
runAlgorithm
public void runAlgorithm()
Description copied from class:AlgorithmBase
Actually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithm
in classAlgorithmBase
-
spm_hrf
public void spm_hrf(double[] hrf, double[] t_hrf, double delta, double t_r, double dur, boolean normalized_hrf, double dt, double p_delay, double undershoot, double p_disp, double u_disp, double p_u_ratio, double onset)
-
test_power_2_padding_length
public void test_power_2_padding_length()
-
test_zero_padd_unpadd
public void test_zero_padd_unpadd()
-
test_zero_mirror_zero_padd_unpadd
public void test_zero_mirror_zero_padd_unpadd()
-
_padd_symetric
public double[] _padd_symetric(double[] arrays, int p, double c, java.lang.String paddtype)
-
_padd_symetric
public double[][] _padd_symetric(double[][] arrays, int p, double c, java.lang.String paddtype)
-
_padd_assymetric
public double[] _padd_assymetric(double[] arrays, int[] p, double c, java.lang.String paddtype)
-
_padd_assymetric
public double[][] _padd_assymetric(double[][] arrays, int[] p, double c, java.lang.String paddtype)
-
_unpadd_symetric
public double[] _unpadd_symetric(double[] arrays, int p, java.lang.String paddtype)
-
_unpadd_symetric
public double[][] _unpadd_symetric(double[][] arrays, int p, java.lang.String paddtype)
-
_unpadd_assymetric
public double[] _unpadd_assymetric(double[] arrays, int[] p, java.lang.String paddtype)
-
_unpadd_assymetric
public double[][] _unpadd_assymetric(double[][] arrays, int[] p, java.lang.String paddtype)
-
log2
public double log2(double x)
-
_custom_padd
public double[] _custom_padd(int[] p_total, double[] a, int min_power_of_2, int min_zero_padd, double zero_padd_ratio)
-
custom_padd
public double[][] custom_padd(int[] padd, double[][] arrays, int min_power_of_2, int min_zero_padd, double zero_padd_ratio)
-
rfft
public double[][] rfft(double[] x)
-
irfft
public double[] irfft(double[][] x, boolean isOdd)
-
spectral_convolve
public double[] spectral_convolve(double[] k, double[] xin)
-
spectral_retro_convolve
public double[] spectral_retro_convolve(double[] k, double[] xin)
-
zabs
private double zabs(double zr, double zi)
zabs computes the absolute value or magnitude of a double precision complex variable zr + j*zi.- Parameters:
zr
- doublezi
- double- Returns:
- double
-
zdiv
private void zdiv(double ar, double ai, double br, double bi, double[] cr, double[] ci)
complex divide c = a/b.- Parameters:
ar
- doubleai
- doublebr
- doublebi
- doublecr
- double[]ci
- double[]
-
spectral_deconvolve
public double[] spectral_deconvolve(double[] k, double[] x)
-
spectral_retro_deconvolve
public double[] spectral_retro_deconvolve(double[] k, double[] x)
-
toeplitz_from_kernel
public double[][] toeplitz_from_kernel(double[] k, int dim_in, int dim_out)
-
simple_convolve
public double[] simple_convolve(double[] k, double[] x, int dim_out)
-
simple_retro_convolve
public double[] simple_retro_convolve(double[] k, double[] x, int dim_out)
-
median
public double median(double[] x)
-
mad
public double mad(double[] x, double c)
-
mad_daub_noise_est
public double mad_daub_noise_est(double[] x, double c)
-
fwhm
public double fwhm(double[] t_hrf, double[] hrf, int k)
-
tp
public double tp(double[] t_hrf, double[] hrf)
-
random_generator
public java.util.Random random_generator(long random_state)
-
spectral_radius_est
public double spectral_radius_est(fMRIBlindDeconvolution.ConvAndLinear L, int x_shape, int nb_iter, double tol, boolean verbose)
-
test_inf_norm
public void test_inf_norm()
-
__inf_norm
public double[] __inf_norm(double[] x)
-
_inf_norm
public double[][] _inf_norm(double[][] arr, int axis)
-
_inf_norm
public double[][] _inf_norm(double[][][] arr, int axis)
-
__inf_norm
public double[][][] __inf_norm(double[][][] x)
-
norm
public double norm(double[] x)
-
add_gaussian_noise
public void add_gaussian_noise(double[] noisy_signal, double[] noise, double[] signal, double snr, boolean haveSeed, long random_state)
-
gen_rnd_ai_s
public void gen_rnd_ai_s(double[] ai_s, double[] i_s, double[] t, double dur, double tr, int nb_events, int avg_dur, double std_dur, boolean middle_spike, boolean overlapping, boolean unitary_block, boolean haveSeed, long random_state, int nb_try, int nb_try_duration, boolean centered)
-
gen_rnd_bloc_bold
public void gen_rnd_bloc_bold(double[] noisy_ar_s, double[] ar_s, double[] ai_s, double[] i_s, double[] t, double[] noise, double dur, double tr, boolean sourcehrf, double[] hrf, int nb_events, int avg_dur, double std_dur, boolean middle_spike, boolean overlapping, boolean unitary_block, double snr, int nb_try, int nb_try_duration, boolean centered, boolean haveSeed, long random_state)
-
_yield_data
public void _yield_data(double[][] noisy_ar_s, double[][] ar_s, double[][] ai_s, double[][] i_s, double[][] hrf, double[][] noise, double[] snr, int[] nb_events)
-
_test_data
public void _test_data(double[] noisy_ar_s, double[] ar_s, double[] ai_s, double[] i_s, double[] hrf, double[] noise, double snr, int nb_events, java.lang.String testnum)
-
test_data_gen
public void test_data_gen()
-
gen_regular_ai_s
public void gen_regular_ai_s(double[] ai_s, double[] i_s, double[] t, int dur, double tr, double dur_bloc, boolean centered)
-
gen_regular_bloc_bold
public void gen_regular_bloc_bold(double[] noisy_ar_s, double[] ar_s, double[] ai_s, double[] i_s, double[] t, double[] noise, int dur, double tr, double dur_bloc, boolean sourcehrf, double[] hrf, double snr, boolean haveSeed, long random_state)
-
gen_rnd_i_s
public void gen_rnd_i_s(double[] i_s, double[] t, int dur, double tr, int nb_events, double avg_ampl, double std_ampl, boolean haveSeed, long random_state, int nb_try, int nb_try_duration, boolean centered)
-
gen_rnd_event_bold
public void gen_rnd_event_bold(double[] noisy_ar_s, double[] ar_s, double[] i_s, double[] t, double[] noise, int dur, double tr, boolean sourcehrf, double[] hrf, int nb_events, double avg_ampl, double std_ampl, double snr, boolean haveSeed, long random_state)
-
yield_diracs_signal
public void yield_diracs_signal(double[][] i_s, double[][] hrf, double[][] alpha, double[] tr)
-
yield_blocks_signal
public void yield_blocks_signal(double[][] ai_s, double[][] hrf, double[][] alpha, double[] tr)
-
_test_conv_toeplitz_kernel_hrf
public void _test_conv_toeplitz_kernel_hrf(double[] ai_s, double[] hrf, java.lang.String testname)
-
test_toeplitz_convolution_kernel_hrf_on_dirac
public void test_toeplitz_convolution_kernel_hrf_on_dirac()
-
test_toeplitz_convolution_kernel_hrf_on_ai_s
public void test_toeplitz_convolution_kernel_hrf_on_ai_s()
-
_test_conv_fourier_kernel_hrf
public void _test_conv_fourier_kernel_hrf(double[] ai_s, double[] hrf, java.lang.String testname)
-
test_fourier_convolution_kernel_hrf_on_dirac
public void test_fourier_convolution_kernel_hrf_on_dirac()
-
test_fourier_convolution_kernel_hrf_on_ai_s
public void test_fourier_convolution_kernel_hrf_on_ai_s()
-
_test_conv_adj_toeplitz_kernel_hrf
public void _test_conv_adj_toeplitz_kernel_hrf(double[] ai_s, double[] hrf, java.lang.String testname)
-
test_toeplitz_adj_convolution_kernel_hrf_on_dirac
public void test_toeplitz_adj_convolution_kernel_hrf_on_dirac()
-
test_toeplitz_adj_convolution_kernel_hrf_on_ai_s
public void test_toeplitz_adj_convolution_kernel_hrf_on_ai_s()
-
_test_conv_adj_fourier_hrf
public void _test_conv_adj_fourier_hrf(double[] ai_s, double[] hrf, java.lang.String testname)
-
test_fourier_adj_convolution_kernel_hrf_on_dirac
public void test_fourier_adj_convolution_kernel_hrf_on_dirac()
-
test_fourier_adj_convolution_kernel_hrf_on_ai_s
public void test_fourier_adj_convolution_kernel_hrf_on_ai_s()
-
_test_conv_toeplitz_kernel_signal
public void _test_conv_toeplitz_kernel_signal(double[] ai_s, double[] hrf, java.lang.String testname)
-
test_toeplitz_convolution_kernel_signal_on_dirac
public void test_toeplitz_convolution_kernel_signal_on_dirac()
-
test_toeplitz_convolution_kernel_signal_on_ai_s
public void test_toeplitz_convolution_kernel_signal_on_ai_s()
-
_test_conv_adj_toeplitz_kernel_signal
public void _test_conv_adj_toeplitz_kernel_signal(double[] ai_s, double[] hrf, java.lang.String testname)
-
test_toeplitz_adj_convolution_kernel_signal_on_dirac
public void test_toeplitz_adj_convolution_kernel_signal_on_dirac()
-
test_toeplitz_adj_convolution_kernel_signal_on_ai_s
public void test_toeplitz_adj_convolution_kernel_signal_on_ai_s()
-
test_integ_op
public void test_integ_op()
-
test_integ_adj
public void test_integ_adj()
-
sign
public double sign(double x)
-
deconv
public void deconv(double[] x, double[] z, double[] diff_z, java.util.Vector<java.lang.Double> J, java.util.Vector<java.lang.Double> R, java.util.Vector<java.lang.Double> G, double[] y, double t_r, double[] hrf, double lbda, boolean early_stopping, double tol, int wind, int nb_iter, int nb_sub_iter, int verbose)
-
std
public double std(double[] x)
-
deconv_example
public void deconv_example()
-
hrf_fit_err
public double hrf_fit_err(double theta, double[] z, double[] y, double t_r, double hrf_dur)
-
hrf_estim
public void hrf_estim(double[] h, java.util.Vector<java.lang.Double> J, double[] z, double[] y, double t_r, double dur, int verbose)
-
simple_hrf_estimation
public void simple_hrf_estimation()
-
_loops_deconv
public double[] _loops_deconv(double[] y, double[] diff_z, double[][] H, double lbda, long nb_iter, boolean early_stopping, long wind, double tol)
-
bd
public void bd(java.util.Vector<java.lang.Double> xout, java.util.Vector<java.lang.Double> zout, java.util.Vector<java.lang.Double> diff_zout, java.util.Vector<java.lang.Double> hout, java.util.Vector<java.lang.Double> dr, java.util.Vector<java.lang.Double> dg, java.util.Vector<java.lang.Double> dJ, double[] y, double t_r, double lbda, double theta, double[] z_0, double hrf_dur, double[] bounds, int nb_iter, int nb_sub_iter, int nb_last_iter, int print_period, boolean early_stopping, int wind, double tol, int verbose)
-
blind_deconvolution_example
public void blind_deconvolution_example()
-
inf_norm
private double inf_norm(double[] x)
-
inf_norm
private double inf_norm(java.util.Vector<java.lang.Double> x)
-
data_generation_example
public void data_generation_example()
-
-