## Define inhomogeneous Field in optimal control

Topics related to Spinach package
kuprov
Posts: 123
Joined: Mon Mar 29, 2021 4:26 pm

### Re: Define inhomogeneous Field in optimal control

Okay, give me a day or so...
kuprov
Posts: 123
Joined: Mon Mar 29, 2021 4:26 pm

### Re: Define inhomogeneous Field in optimal control

OK, get and install the developer version as described here:

http://spindynamics.org/group/?page_id=12

then specify control.ens_corrs={'power_drift'}; in the control specification block. Make sure the number of powers is equal to the number of drifts. That's it - each drift would use its own control power.
Mengjia He
Posts: 16
Joined: Thu Jan 20, 2022 8:28 am

### Re: Define inhomogeneous Field in optimal control

Ok, I will go ahead my simulation.

Many thanks for your quick update and guidance.
Mengjia He
Posts: 16
Joined: Thu Jan 20, 2022 8:28 am

### Re: Define inhomogeneous Field in optimal control

Dear Prof. Kuprov,

As we know, an inhomogeneous field include its amplitude distortion and direction distortion. For example, an x-axis coil radiate not only amplitude reduced Bx compenent, but also tiny By component. From the point of pulse sequence, the direction distortion means phase change for different parts of the ensemble.

Spinach uses control.pwr_levels to define non-uniform B1 field, this parameters can only include the amplitude part. I guess it will be great if Spinach has considered the direction part or include this in the future.

Best regards,
Mengjia
kuprov
Posts: 123
Joined: Mon Mar 29, 2021 4:26 pm

### Re: Define inhomogeneous Field in optimal control

Spinach can do that. For arbitrarily inhomogeneous B0, use an ensemble over the drift Hamiltonians.

For arbitrary inhomogeneous B1, put a loop around the call to GRAPE, and use different control operators for each instance of the loop. Alternatively, merge multiple spin systems into one block-diagonal problem and assign different B1 directions in each block.
Mengjia He
Posts: 16
Joined: Thu Jan 20, 2022 8:28 am

### Re: Define inhomogeneous Field in optimal control

kuprov wrote: Wed Mar 16, 2022 12:01 pm Spinach can do that. For arbitrarily inhomogeneous B0, use an ensemble over the drift Hamiltonians.

For arbitrary inhomogeneous B1, put a loop around the call to GRAPE, and use different control operators for each instance of the loop. Alternatively, merge multiple spin systems into one block-diagonal problem and assign different B1 directions in each block.
For "put a loop around the call to GRAPE", you mean use GRAPE to calculate cost for each voxel, and add these costs to construct a new cost funtion as handle in fminnewton.m ?
kuprov
Posts: 123
Joined: Mon Mar 29, 2021 4:26 pm

Yep