Commit cb00c240 authored by Tom Hartley's avatar Tom Hartley
Browse files

Change module title in UI.

Delete old asv file.
parent 17194a06
No preview for this file type
%%
%alternating blocks with rest
%total duration fixed (384s)
%template with fixed 12s on 12s design
total_duration=384.0;
n_blocks_per_cond=12;
active_block_duration=12.0;
cond=repmat([1 0 2 0],1,n_blocks_per_cond);
u=unique(cond);
u_active=u(u>0);
n_active_conditions=length(u_active);
total_active_time=active_block_duration*n_blocks_per_cond*n_active_conditions;
total_rest_duration=total_duration-total_active_time
block_duration=zeros(size(cond));
block_duration(cond>0)=active_block_duration;
block_duration(cond==0)=total_rest_duration/sum(cond==0);
block_onset=cumsum([0 block_duration]);
block_onset=block_onset(1:end-1);
Q=[block_onset(cond>0)' block_duration(cond>0)' cond(cond>0)'];
[M, Mhrf, RMhrf, MCRMhrf, mbase]=rdan_mock_fMRI_model(total_duration,16,3.0,'','',Q); %Use Q to generate a 120s timeseries with time step 1/16, TR=3.0s
[eff_simple, VRF, bold_simple]=rdan_design_efficiency(MCRMhrf',[1 0 0]');
[eff_subtraction, VRF, bold_subtraction]=rdan_design_efficiency(MCRMhrf',[1 -1 0]');
[eff_active, VRF, bold_active]=rdan_design_efficiency(MCRMhrf',[1 1 0]');
%%
%alternating blocks with rest
%total duration fixed (384s)
%vary active block duration keeping block number constant
vary_block_duration=[3:3:24]
figure(1)
for v=1:length(vary_block_duration)
[Q,cond,block_onset,block_duration]= rdan_block_design_builder(384,8,vary_block_duration(v),[1 2 0],'no')
[M, Mhrf, RMhrf, MCRMhrf, mbase]=rdan_mock_fMRI_model(total_duration,16,3.0,'','',Q); %Use Q to generate a 120s timeseries with time step 1/16, TR=3.0s
subplot(8,1,v)
%plot(MCRMhrf')
plot(mbase,M(1:end-1,:),'LineWidth',2)
drawnow;
[eff_simple_vbd(v), VRF, bold_simple_vbd(v)]=rdan_design_efficiency(MCRMhrf',[1 0 0]');
[eff_subtraction_vbd(v), VRF, bold_subtraction_vbd(v)]=rdan_design_efficiency(MCRMhrf',[1 -1 0]');
[eff_active_vbd(v), VRF, bold_active_vbd(v)]=rdan_design_efficiency(MCRMhrf',[1 1 0]');
end
figure(2)
plot(vary_block_duration,bold_simple_vbd,'k')
hold on
plot(vary_block_duration,bold_subtraction_vbd)
plot(vary_block_duration,bold_active_vbd)
hold off
axis([0 25 0 2])
legend({'simple','subtraction','active'})
xlabel('block duration (s)')
ylabel('detectable BOLD signal change')
%%
%alternating blocks with rest
%total duration fixed (384s)
%vary active block duration keeping block number constant
%rest after every active block
vary_block_duration=[3:3:24]
figure(3)
for v=1:length(vary_block_duration)
[Q,cond,block_onset,block_duration]= rdan_block_design_builder(384,8,vary_block_duration(v),[1 0 2 0],'no')
[M, Mhrf, RMhrf, MCRMhrf, mbase]=rdan_mock_fMRI_model(total_duration,16,3.0,'','',Q); %Use Q to generate a 120s timeseries with time step 1/16, TR=3.0s
subplot(8,1,v)
%plot(MCRMhrf')
plot(mbase,M(1:end-1,:),'LineWidth',2)
drawnow;
[eff_simple_vbd(v), VRF, bold_simple_vbd(v)]=rdan_design_efficiency(MCRMhrf',[1 0 0]');
[eff_subtraction_vbd(v), VRF, bold_subtraction_vbd(v)]=rdan_design_efficiency(MCRMhrf',[1 -1 0]');
[eff_active_vbd(v), VRF, bold_active_vbd(v)]=rdan_design_efficiency(MCRMhrf',[1 1 0]');
end
figure(4)
plot(vary_block_duration,bold_simple_vbd,'k')
hold on
plot(vary_block_duration,bold_subtraction_vbd)
plot(vary_block_duration,bold_active_vbd)
hold off
axis([0 25 0 2])
legend({'simple','subtraction','active'})
xlabel('block duration (s)')
ylabel('detectable BOLD signal change')
%%
%alternating blocks with rest
%total duration and number of blocks varies
%fixed block duration (12s)
%rest after every active block
vary_total_duration=[120:120:960]
vary_block_number=floor(vary_total_duration./32)
figure(5)
for v=1:length(vary_total_duration)
[Q,cond,block_onset,block_duration]= rdan_block_design_builder(vary_total_duration(v),vary_block_number(v),12.0,[1 0 2 0],'no')
[M, Mhrf, RMhrf, MCRMhrf, mbase]=rdan_mock_fMRI_model(vary_total_duration(v),16,3.0,'','',Q); %Use Q to generate a 120s timeseries with time step 1/16, TR=3.0s
subplot(8,1,v)
%plot(MCRMhrf')
plot(mbase,M(1:end-1,:),'LineWidth',2)
axis([0 1000 0 1])
drawnow;
[eff_simple_vtd(v), VRF, bold_simple_vtd(v)]=rdan_design_efficiency(MCRMhrf',[1 0 0]');
[eff_subtraction_vtd(v), VRF, bold_subtraction_vtd(v)]=rdan_design_efficiency(MCRMhrf',[1 -1 0]');
[eff_active_vtd(v), VRF, bold_active_vtd(v)]=rdan_design_efficiency(MCRMhrf',[1 1 0]');
end
figure(6)
plot(vary_total_duration,bold_simple_vtd,'k')
hold on
plot(vary_total_duration,bold_subtraction_vtd)
plot(vary_total_duration,bold_active_vtd)
hold off
axis([0 1000 0 2])
legend({'simple','subtraction','active'})
xlabel('total duration (s)')
ylabel('detectable BOLD signal change')
%%
%alternating blocks with rest
%total duration fixed (384s)
%vary active block duration keeping block number constant
%rest after every active block
vary_block_duration=[3 6 9 12 18 24 36 48]
vary_block_number=floor(96./vary_block_duration)
figure(7)
for v=1:length(vary_block_duration)
[Q,cond,block_onset,block_duration]= rdan_block_design_builder(384,vary_block_number(v),vary_block_duration(v),[1 0 2 0],'no')
[M, Mhrf, RMhrf, MCRMhrf, mbase]=rdan_mock_fMRI_model(total_duration,16,3.0,'','',Q); %Use Q to generate a 120s timeseries with time step 1/16, TR=3.0s
peak_to_trough(:,v)=max(MCRMhrf,[],2)-min(MCRMhrf,[],2)
subplot(8,1,v)
%plot(MCRMhrf')
plot(mbase,M(1:end-1,:),'LineWidth',2)
drawnow;
[eff_simple_vbr(v), VRF, bold_simple_vbr(v)]=rdan_design_efficiency(MCRMhrf',[1 0 0]');
[eff_subtraction_vbr(v), VRF, bold_subtraction_vbr(v)]=rdan_design_efficiency(MCRMhrf',[1 -1 0]');
[eff_active_vbr(v), VRF, bold_active_vbr(v)]=rdan_design_efficiency(MCRMhrf',[1 1 0]');
end
figure(8)
plot(vary_block_duration,bold_simple_vbr,'k')
hold on
plot(vary_block_duration,bold_subtraction_vbr)
plot(vary_block_duration,bold_active_vbr)
hold off
axis([0 25 0 2])
legend({'simple','subtraction','active'})
xlabel('block duration (s)')
ylabel('detectable BOLD signal change')
figure(9)
plot(vary_block_duration,peak_to_trough(1,:))
xlabel('block duration (s)')
ylabel('total peak to trough signal')
axis([0 25 0 1.5])
%%
num_events=[24:12:120]
vary_total_duration=[96:48:480]
figure(10)
for v=1:length(num_events)
filelist={['ev_files/eff_design/EV_A_event' num2str(num_events(v)) '.txt'],
['ev_files/eff_design/EV_B_event' num2str(num_events(v)) '.txt']}
Q=rdan_glm_demo_from_ev_files(filelist)
[M, Mhrf, RMhrf, MCRMhrf, mbase]=rdan_mock_fMRI_model(vary_total_duration(v),16,3.0,'','',Q); %Use Q to generate a 120s timeseries with time step 1/16, TR=3.0s
peak_to_trough(:,v)=max(MCRMhrf,[],2)-min(MCRMhrf,[],2)
subplot(9,1,v)
%plot(MCRMhrf')
plot(mbase,M(1:end-1,:),'LineWidth',2)
axis([0
drawnow;
[eff_simple_vne(v), VRF, bold_simple_vne(v)]=rdan_design_efficiency(MCRMhrf',[1 0 0]');
[eff_subtraction_vne(v), VRF, bold_subtraction_vne(v)]=rdan_design_efficiency(MCRMhrf',[1 -1 0]');
[eff_active_vne(v), VRF, bold_active_vne(v)]=rdan_design_efficiency(MCRMhrf',[1 1 0]');
end
figure(11)
plot(num_events,bold_simple_vne,'k')
hold on
plot(num_events,bold_subtraction_vne)
plot(num_events,bold_active_vne)
hold off
axis([24 120 0 2])
legend({'simple','subtraction','active'})
xlabel('number of events')
ylabel('detectable BOLD signal change')
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment