/usr/share/odin/sequences/odinpilot.cpp is in odin 1.8.8-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | //////////////////////////////////////////////////////////////////////////////
//
// A navigator sequence for the ODIN framework
//
//////////////////////////////////////////////////////////////////////////////
// includes for the sequence objects
#include <odinseq/seqall.h>
// The method itself is a class that is derived from
// an abstract base class 'SeqMethod' that contains all
// routines common to all methods:
class METHOD_CLASS : public SeqMethod {
public:
// Constructor that takes the methods identifier (unique string) as its argument
METHOD_CLASS(const STD_string& label);
// virtual functions that are overwritten in this method to build the sequence,
// calculate parameter relations, etc.:
void method_pars_init();
void method_seq_init();
void method_rels();
void method_pars_set();
private:
// Parameters for this method:
JDXfloat T1Ernst;
JDXint DummyCycles;
JDXint NumSagSlices;
JDXint NumCorSlices;
JDXint NumAxiSlices;
JDXfloat PilotSliceDist;
// Sequence objects for this method:
SeqPulsar exc;
SeqDelay relaxdelay;
SeqObjLoop peloop;
SeqObjLoop sliceloop;
SeqObjLoop reploop;
SeqObjLoop dummyloop;
SeqObjList scanpart;
SeqObjList dummypart;
SeqDelay dummypad;
SeqGradEcho grech;
SeqGradTrapezParallel crusher;
SeqDelay crusherdelay;
SeqRotMatrixVector pilotrot;
unsigned int nslices;
ivector nslices_dir;
dvector dirvec;
Geometry area[n_orientations];
};
////////////////////////////////////////////////////////////////////////////////////
METHOD_CLASS::METHOD_CLASS (const STD_string& label)
: SeqMethod(label) {
// Put in here all stuff that will once be initialised and
// never changed
// Specify a short description of the method
set_description("Navigator which acquires three orthogonal sets of slices." );
}
////////////////////////////////////////////////////////////////////////////////////
void METHOD_CLASS::method_pars_init() {
// In this function the methods parameters will be initialised
// Assign default values:
commonPars->set_RepetitionTime(300.0);
commonPars->set_AcqSweepWidth(25.0);
commonPars->set_MatrixSize(readDirection,128);
// set default values and a short a description (which
// will appear as a tooltip in the UI) for each parameter
T1Ernst=1300.0;
T1Ernst.set_minmaxval(0.0,5000.0).set_description("For optimum SNR, the flip angle will be set to the Ernst angle using this T1");
DummyCycles=3;
DummyCycles.set_description("Number of dummy shots before actual acquisition");
NumSagSlices=3;
NumSagSlices.set_description("Number of sagittal slices in Pilot");
NumCorSlices=3;
NumCorSlices.set_description("Number of coronal slices in Pilot");
NumAxiSlices=3;
NumAxiSlices.set_description("Number of axial slices in Pilot");
PilotSliceDist=25.0;
PilotSliceDist.set_description("Slice distance of Pilot");
// Make method specific parameters visible in the user interface
append_parameter(T1Ernst,"T1Ernst");
append_parameter(DummyCycles,"DummyCycles");
append_parameter(NumSagSlices,"NumSagSlices");
append_parameter(NumCorSlices,"NumCorSlices");
append_parameter(NumAxiSlices,"NumAxiSlices");
append_parameter(PilotSliceDist,"PilotSliceDist");
}
////////////////////////////////////////////////////////////////////////////////////
void METHOD_CLASS::method_seq_init() {
Log<Seq> odinlog(this,"method_seq_init");
// Put in here all stuff to create the layout of the sequence
// number of slices in each direction
nslices_dir.resize(n_orientations);
nslices_dir[sagittal]=NumSagSlices;
nslices_dir[coronal]=NumCorSlices;
nslices_dir[axial]=NumAxiSlices;
nslices=nslices_dir.sum();
geometryInfo->reset(); // Use default orientations
///////////////// Excitation Pulse: /////////////////////
// Get the slice thickness from the global geometry handler 'geometryInfo':
float slicethick=4.0;
// Create the sinc shaped excitation pulse.
exc=SeqPulsarSinc("exc",slicethick,false,2.0,commonPars->get_FlipAngle());
// This is useful for simulating/visualization of the sequence
exc.set_pulse_type(excitation);
// Do not use maxDistEncoding
exc.set_encoding_scheme(linearEncoding);
// Pilot rotation and slice offset
dvector offset(nslices);
offset=0.0;
pilotrot=SeqRotMatrixVector("pilotrot");
dirvec.resize(nslices);
int ioffset=0;
for(int idir=0; idir<n_orientations; idir++) {
area[idir].set_orientation(sliceOrientation(idir));
area[idir].set_nSlices(nslices_dir[idir]);
area[idir].set_sliceDistance(PilotSliceDist);
dvector slicevec=area[idir].get_sliceOffsetVector();
for(int islice=0; islice<nslices_dir[idir]; islice++) {
offset[ioffset]=slicevec[islice];
dirvec[ioffset]=idir;
pilotrot.append(area[idir].get_gradrotmatrix());
ioffset++;
}
}
ODINLOG(odinlog,significantDebug) << "offset=" << offset << STD_endl;
// Set the frequency list of the excitation pulse so that we will excite all slices in the slicepack
exc.set_freqlist( systemInfo->get_gamma("") * exc.get_strength() / (2.0*PII) * offset );
ivector iv(nslices);
iv=0;
exc.set_indexvec(iv); // Always set zero slice index, indexing will be done by userdef dimension
// This loop object is used to loop over the slices
sliceloop=SeqObjLoop("sliceloop");
////////////////// Geometry: /////////////////////////////////
// calculate the resolution in the read Channel and set the number of phase encoding
// steps so that we will obtain a uniform resolution in read and phase Channel:
float resolution=secureDivision(geometryInfo->get_FOV(readDirection),commonPars->get_MatrixSize(readDirection));
commonPars->set_MatrixSize(phaseDirection,int(secureDivision(geometryInfo->get_FOV(phaseDirection),resolution)+0.5),noedit);
//////////////// Delays: //////////////////////////////
// relaxation delay after each readout
relaxdelay=SeqDelay("relaxdelay");
//////////////// Gradient Echo Module: //////////////////////////////
float os_factor=2.0; // avoid cut-off in read direction for off-center FOV
// This is the gradient-recalled echo kernel of the sequence.
// Calculations of read/phase gradient strengts and durations are
// performed by this module itself so we just have to pass in the size and FOV
// in each direction. This module has a tight timing scheme so that short TE is possible.
grech=SeqGradEcho("grech", exc, commonPars->get_AcqSweepWidth(),
commonPars->get_MatrixSize(readDirection), geometryInfo->get_FOV(readDirection),
commonPars->get_MatrixSize(phaseDirection), geometryInfo->get_FOV(phaseDirection),
linearEncoding, noReorder, 1, commonPars->get_ReductionFactor(), DEFAULT_ACL_BANDS,
false, commonPars->get_PartialFourier(),0.0,false,os_factor);
grech.set_gradrotmatrixvector(pilotrot); // rotate grech
//////////////// Crusher Gradient: //////////////////////////////
float crusher_strength=0.5*systemInfo->get_max_grad();
float crusher_integral=4.0*fabs(grech.get_gradintegral().sum());
crusher=SeqGradTrapezParallel("crusher",crusher_integral,crusher_integral,crusher_integral, crusher_strength);
crusherdelay=SeqDelay("crusherdelay",0.1); // Small delay to avoid gradient-induced stimulation
//////////////// Loops: //////////////////////////////
// Construct a loop object to iterate through the phase encoding steps
peloop=SeqObjLoop("peloop");
// Construct a loop object to perform repetitions of the experiment
reploop=SeqObjLoop("reploop");
// Construct a loop object to perform dummy cylces
dummyloop=SeqObjLoop("dummyloop");
//////////////// Constructing the Sequence: ///////////////
// This sequence container will hold the objects for one readout:
scanpart=SeqObjList("scanpart");
scanpart = grech + crusherdelay + crusher;
// Contains kernel of one dummy cycle
dummypart=SeqObjList("dummypart");
dummypad=SeqDelay("dummypad",scanpart.get_duration()-exc.get_duration()); // Padding delay for dummy cycle
dummypart = exc + dummypad + relaxdelay;
// Finally, build the whole sequence
set_sequence(
dummyloop(
sliceloop(
dummypart
)[grech.get_exc_vector()][pilotrot]
)[DummyCycles]
+ peloop(
sliceloop(
scanpart + relaxdelay // the sequence kernel
)[grech.get_exc_vector()][pilotrot]
)[grech.get_pe_vector()]
);
}
////////////////////////////////////////////////////////////////////////////////////
void METHOD_CLASS::method_rels() {
// Put in here all stuff that has to be performed whenever one of the sequence parameters
// has been changed by the user
// calculate relaxdelay to get the desired repetition time
float scandur=scanpart.get_duration()*float(nslices);
if(scandur>commonPars->get_RepetitionTime()) commonPars->set_RepetitionTime(scandur);
relaxdelay.set_duration( (commonPars->get_RepetitionTime()-scandur)/float(nslices) );
// calculate Ernst angle accordng to TR
float flipangle=180.0/PII * acos( exp ( -secureDivision ( commonPars->get_RepetitionTime(), T1Ernst) ) );
commonPars->set_FlipAngle( flipangle, noedit );
exc.set_flipangle( flipangle );
// retrieve echo time from gradient echo module to display it in the user interface
commonPars->set_EchoTime(grech.get_echo_time(), noedit );
}
////////////////////////////////////////////////////////////////////////////////////
void METHOD_CLASS::method_pars_set() {
// Put in here all stuff that has to be performed after the parameters have been edited by the user
// and before the sequence is played out
// for odinreco
grech.set_reco_vector(userdef,pilotrot,dirvec); // distinguish slices by their orientation
recoInfo->set_Recipe("kspace | fft | offset | oversampling | usercoll | pilot("+ftos(PilotSliceDist)+") | store");
}
////////////////////////////////////////////////////////////////////////////////////
// entry point for the sequence module
ODINMETHOD_ENTRY_POINT
|