Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Skullervo authored Aug 12, 2022
1 parent 60126e3 commit 653a824
Show file tree
Hide file tree
Showing 11 changed files with 642 additions and 0 deletions.
87 changes: 87 additions & 0 deletions MRiLab 1.2.1/MRiLab.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
% _______
% _________________________________________ / _____ \
% . . |---- (OO)| ___ | | | | |
% /\ /\ |__ | || | / \ |___ |_| |_|
% / \/ \ | \ || | \___/ | \ |S| |N|
% / || \ | \_ || |____| \ |___/ MRI Simulator
% _________________________________________
% Numerical MRI Simulation Package
% Version 1.2 - https://sourceforge.net/projects/mrilab/
%
% The MRiLab is a numerical MRI simulation package. It has been developed to
% simulate factors that affect MR signal formation, acquisition and image
% reconstruction. The simulation package features highly interactive graphic
% user interface for various simulation purposes. MRiLab provides several
% toolboxes for MR researchers to analyze RF pulse, design MR sequence,
% configure multiple transmitting and receiving coils, investigate B0
% in-homogeneity and object motion sensitivity et.al. The main simulation
% platform combined with these toolboxes can be applied for customizing
% various virtual MR experiments which can serve as a prior stage for
% prototyping and testing new MR technique and application.
%
% Author:
% Fang Liu <leoliuf@gmail.com>
% University of Wisconsin-Madison
% April-6-2014
% _________________________________________________________________________
% Copyright (c) 2011-2014, Fang Liu <leoliuf@gmail.com>
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are
% met:
%
% * Redistributions of source code must retain the above copyright
% notice, this list of conditions and the following disclaimer.
% * Redistributions in binary form must reproduce the above copyright
% notice, this list of conditions and the following disclaimer in
% the documentation and/or other materials provided with the distribution
%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.
% _________________________________________________________________________

%%%%%%%%%%%%%%%%%%%% MRiLab setup%%%%%%%%%%%%%%%%%%%%%%
function MRiLab

warning off; % disable warning

[pathstr,name,ext]=fileparts(mfilename('fullpath'));

% Check MEX existence
fpath = [pathstr filesep 'Lib' filesep 'bin'];
if exist([fpath filesep 'DoScanAtCPU.mexw64'], 'file')
% MEX exist, do nothing
else
try
fileUrl = ['http://mrilab.sourceforge.net/bin/MRiLab1.2Bin.zip'];
zipFileName = fullfile(fpath,'MRiLab1.2Bin.zip');
disp('Downloading core MEX files from MRiLab website http://sourceforge.net/projects/mrilab/');
urlwrite(fileUrl,zipFileName);
disp('Unzip files ...');
unzip(zipFileName,fpath);
rehash;
catch me
error_msg{1,1}='Some core MEX files for running MRiLab can not be configured.';
error_msg{2,1}='Please download MRiLab full version with all MEX configured from';
error_msg{3,1}='http://sourceforge.net/projects/mrilab/';
errordlg(error_msg);
return;
end
end

% Open MRiLab main panel
addpath(genpath(pathstr));
SimuPanel(pathstr);
clear pathstr name ext

end
98 changes: 98 additions & 0 deletions MRiLab 1.2.1/VObj/Head/VObj_SphereHead/VObj_SphereHead.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MRiLab auto generated file: DO NOT EDIT! %
% Generated by MRiLab "DoWriteXML2m" Generator %
% MRiLab Version 1.2 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Obj, VObj]=VObj_SphereHead(flag)
%====================================
VObj.Gyro=[267538030.3797];
AttributeOpt={'Normal','MT','ME'};
VObj.Model=AttributeOpt{1};
VObj.Name='VObj_SphereHead';
VObj.Notes='3D Sphere Head Object';
VObj.Type='Water';
VObj.TypeNum=[1];
VObj.XDim=[90];
VObj.XDimRes=[0.002];
VObj.YDim=[90];
VObj.YDimRes=[0.002];
VObj.ZDim=[90];
VObj.ZDimRes=[0.002];
[x,y,z]=meshgrid(((-(VObj.XDim-1)/2):((VObj.XDim-1)/2))*VObj.XDimRes,((-(VObj.YDim-1)/2):((VObj.YDim-1)/2))*VObj.YDimRes,((-(VObj.ZDim-1)/2):((VObj.ZDim-1)/2))*VObj.ZDimRes);
rho=zeros([size(x) VObj.TypeNum]);
t1=zeros([size(x) VObj.TypeNum]);
t2=zeros([size(x) VObj.TypeNum]);
t2star=zeros([size(x) VObj.TypeNum]);
chemshift=zeros(1,VObj.TypeNum);
k=zeros([size(x) VObj.TypeNum^2]);
%====================================
Alpha=[1];
Color='b';
Notes='Cube Object';
p.CenterX=[0.015];
p.CenterY=[0.015];
p.CenterZ=[0.015];
p.Length=[0.03];
ChemShift=[0];
K=[10];
Rho=[1];
T1=[1];
T2=[0.1];
T2Star=[0.01];
TypeIdx=[1];
[mask, fvc]=VObjCube(p,x,y,z,flag);
Obj{1,1}=fvc;
Obj{2,1}=Color;
Obj{3,1}=Alpha;
rho(:,:,:,TypeIdx)=rho(:,:,:,TypeIdx)+mask.*Rho;
t1(:,:,:,TypeIdx)=t1(:,:,:,TypeIdx)+mask.*T1;
t2(:,:,:,TypeIdx)=t2(:,:,:,TypeIdx)+mask.*T2;
t2star(:,:,:,TypeIdx)=t2star(:,:,:,TypeIdx)+mask.*T2Star;
chemshift(TypeIdx)=ChemShift;
if ~strcmp(VObj.Model,'Normal')
for i=1:VObj.TypeNum
k(:,:,:,(TypeIdx-1)*VObj.TypeNum+i)=k(:,:,:,(TypeIdx-1)*VObj.TypeNum+i)+mask.*K(i);
end
end
p=[];
%--------------------
Alpha=[1];
Color='r';
Notes='Sphere Object';
p.CenterX=[0];
p.CenterY=[-0.04];
p.CenterZ=[0];
p.FaceNum=[20];
p.Radius=[0.04];
ChemShift=[0];
K=[10];
Rho=[1];
T1=[1];
T2=[0.1];
T2Star=[0.01];
TypeIdx=[1];
[mask, fvc]=VObjSphere(p,x,y,z,flag);
Obj{1,2}=fvc;
Obj{2,2}=Color;
Obj{3,2}=Alpha;
rho(:,:,:,TypeIdx)=rho(:,:,:,TypeIdx)+mask.*Rho;
t1(:,:,:,TypeIdx)=t1(:,:,:,TypeIdx)+mask.*T1;
t2(:,:,:,TypeIdx)=t2(:,:,:,TypeIdx)+mask.*T2;
t2star(:,:,:,TypeIdx)=t2star(:,:,:,TypeIdx)+mask.*T2Star;
chemshift(TypeIdx)=ChemShift;
if ~strcmp(VObj.Model,'Normal')
for i=1:VObj.TypeNum
k(:,:,:,(TypeIdx-1)*VObj.TypeNum+i)=k(:,:,:,(TypeIdx-1)*VObj.TypeNum+i)+mask.*K(i);
end
end
p=[];
%--------------------
VObj.Rho=rho;
VObj.T1=t1;
VObj.T2=t2;
VObj.T2Star=t2star;
VObj.ChemShift=chemshift;
if ~strcmp(VObj.Model,'Normal')
VObj.K=k;
end
end
Binary file not shown.
11 changes: 11 additions & 0 deletions MRiLab 1.2.1/VObj/Head/VObj_SphereHead/VObj_SphereHead.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<MRiLabVObj Gyro="267538030.3797" Model="$1'Normal','MT','ME'" Name="VObj_SphereHead" Notes="3D Sphere Head Object" Type="Water" TypeNum="1" XDim="90" XDimRes="0.002" YDim="90" YDimRes="0.002" ZDim="90" ZDimRes="0.002">
<VObjCube Alpha="1" Color="b" Notes="Cube Object">
<Geometry CenterX="0.015" CenterY="0.015" CenterZ="0.015" Length="0.03"/>
<Property ChemShift="0" K="10" Rho="1" T1="1" T2="0.1" T2Star="0.01" TypeIdx="1"/>
</VObjCube>
<VObjSphere Alpha="1" Color="r" Notes="Sphere Object">
<Geometry CenterX="0" CenterY="-0.04" CenterZ="0" FaceNum="20" Radius="0.04"/>
<Property ChemShift="0" K="10" Rho="1" T1="1" T2="0.1" T2Star="0.01" TypeIdx="1"/>
</VObjSphere>
</MRiLabVObj>
93 changes: 93 additions & 0 deletions MRiLab 1.2.1/VObjElem/VObjCube.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
% _______
% _________________________________________ / _____ \
% . . |---- (OO)| ___ | | | | |
% /\ /\ |__ | || | / \ |___ |_| |_|
% / \/ \ | \ || | \___/ | \ |S| |N|
% / || \ | \_ || |____| \ |___/ MRI Simulator
% _________________________________________
% Numerical MRI Simulation Package
% Version 1.2 - https://sourceforge.net/projects/mrilab/
%
% The MRiLab is a numerical MRI simulation package. It has been developed to
% simulate factors that affect MR signal formation, acquisition and image
% reconstruction. The simulation package features highly interactive graphic
% user interface for various simulation purposes. MRiLab provides several
% toolboxes for MR researchers to analyze RF pulse, design MR sequence,
% configure multiple transmitting and receiving coils, investigate B0
% in-homogeneity and object motion sensitivity et.al. The main simulation
% platform combined with these toolboxes can be applied for customizing
% various virtual MR experiments which can serve as a prior stage for
% prototyping and testing new MR technique and application.
%
% Author:
% Fang Liu <leoliuf@gmail.com>
% University of Wisconsin-Madison
% April-6-2014
% _________________________________________________________________________
% Copyright (c) 2011-2014, Fang Liu <leoliuf@gmail.com>
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are
% met:
%
% * Redistributions of source code must retain the above copyright
% notice, this list of conditions and the following disclaimer.
% * Redistributions in binary form must reproduce the above copyright
% notice, this list of conditions and the following disclaimer in
% the documentation and/or other materials provided with the distribution
%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.
% _________________________________________________________________________

function [mask, fvc]=VObjCube(p,x,y,z,flag)
%create 3D cube virtual object

% Initialize parameters
Length=p.Length;
CenterX=p.CenterX;
CenterY=p.CenterY;
CenterZ=p.CenterZ;

% Generate cube coordinate
vertices = [1 1 -1;
-1 1 -1;
-1 1 1;
1 1 1;
-1 -1 1;
1 -1 1;
1 -1 -1;
-1 -1 -1] * 0.5 * Length;

faces = [1 2 3 4;
4 3 5 6;
6 7 8 5;
1 2 8 7;
6 7 1 4;
2 3 5 8];

vertices(:,1)=vertices(:,1)+CenterX;
vertices(:,2)=vertices(:,2)+CenterY;
vertices(:,3)=vertices(:,3)+CenterZ;

fvc.vertices=vertices;
fvc.faces=faces;

if flag~=1 % Render object only
mask=0;
return;
end

mask = vert2mask(fvc.vertices,x,y,z);

end
79 changes: 79 additions & 0 deletions MRiLab 1.2.1/VObjElem/VObjCylinder.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
% _______
% _________________________________________ / _____ \
% . . |---- (OO)| ___ | | | | |
% /\ /\ |__ | || | / \ |___ |_| |_|
% / \/ \ | \ || | \___/ | \ |S| |N|
% / || \ | \_ || |____| \ |___/ MRI Simulator
% _________________________________________
% Numerical MRI Simulation Package
% Version 1.2 - https://sourceforge.net/projects/mrilab/
%
% The MRiLab is a numerical MRI simulation package. It has been developed to
% simulate factors that affect MR signal formation, acquisition and image
% reconstruction. The simulation package features highly interactive graphic
% user interface for various simulation purposes. MRiLab provides several
% toolboxes for MR researchers to analyze RF pulse, design MR sequence,
% configure multiple transmitting and receiving coils, investigate B0
% in-homogeneity and object motion sensitivity et.al. The main simulation
% platform combined with these toolboxes can be applied for customizing
% various virtual MR experiments which can serve as a prior stage for
% prototyping and testing new MR technique and application.
%
% Author:
% Fang Liu <leoliuf@gmail.com>
% University of Wisconsin-Madison
% April-6-2014
% _________________________________________________________________________
% Copyright (c) 2011-2014, Fang Liu <leoliuf@gmail.com>
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are
% met:
%
% * Redistributions of source code must retain the above copyright
% notice, this list of conditions and the following disclaimer.
% * Redistributions in binary form must reproduce the above copyright
% notice, this list of conditions and the following disclaimer in
% the documentation and/or other materials provided with the distribution
%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGE.
% _________________________________________________________________________

function [mask, fvc]=VObjCylinder(p,x,y,z,flag)
%create 3D cylinder virtual object

% Initialize parameters
Radius=p.Radius;
FaceNum=p.FaceNum;
Length=p.Length;
CenterX=p.CenterX;
CenterY=p.CenterY;
CenterZ=p.CenterZ;

% Generate cylinder coordinate
[X,Y,Z] = cylinder(Radius,FaceNum);
X=X+CenterX;
Y=Y+CenterY;
Z=(Z-0.5)*Length/2+CenterZ;

fvc = surf2patch(X,Y,Z);

if flag~=1 % Render object only
mask=0;
return;
end

mask = vert2mask(fvc.vertices,x,y,z);

end
Loading

0 comments on commit 653a824

Please sign in to comment.