Search
Perfusion Flow mapping

Octave/Python Perfusion Flow mapping, SoS Script of Scripts

%use Octave
#% example of QPerf perfusion flow mapping
pkg load image
clear all
close all

#% suppose the QPerf repo was cloned to QPerf directory
#% git clone ...

#% load the stored data

#%cd .\QPerf\examples
%use Octave
load perf_data_stress
%use Octave
working_directory = pwd
%use Octave
working_directory =strrep(working_directory , "\\", "/");
%use Octave
command = [working_directory '/software/QPerf/gadgetron_QPerf_mapping -f ./aif_stress -i ./data_stress -m ./MBF_stress --foot ' num2str(foot) ' --dt 500'];
dos(command);
%use Octave
graphics_toolkit('gnuplot')
%plot gnuplot
%use Octave
% load and visualize map
fmap = analyze75read('MBF_stress.hdr');
%use Octave
figure;
plot(aif);
title('AIF');
figure;imshow(fmap, 'DisplayRange', [0 6]);PerfColorMap;

Plot of AIF with Python Plotly

%use Python3
import plotly.graph_objects as go
import plotly
from IPython.core.display import display, HTML
import pandas as pd

import plotly.express as px
from skimage import io
img = io.imread('/home/jovyan/work/QPerf_book/content/03/images/aif.jpg')
fig = px.imshow(img)
#fig.show()
plotly.offline.plot(fig, filename = 'aif.html')
display(HTML('aif.html'))

Plot of MBF with Python Plotly

%use Python3

img = io.imread('/home/jovyan/work/QPerf_book/content/03/images/fmap_stress.jpg')
fig = px.imshow(img)
#fig.show()
plotly.offline.plot(fig, filename = 'fmap_stress.html')
display(HTML('fmap_stress.html'))