It is the Project file of unity. you can open with unity.(test version is 2020.3 )
This is build file of unity. you can directly run by MRI Seq Visualizer.exe
- Add JSON Sequence in to Path:
..\MRI SeqPuls\MRI Seq Visualizer_Data\StreamingAssets
- Then change the name in the top left to the same name as the Json File
- Load to load json file
- run manually event by event
- Set fps (Event per second), default is 5.
- start
Copy the SpinRecorder.py to the Path show in below:
--Your MRIPULSEQ Git Path--\code\MRtwin\core
Add following two line in to the Scanner.py, you can find it in the same path as before.
class Scanner:
def set_gradient_precession_tensor_super(self,grad_moms,flips):
self.flipEvent = flips # add
self.gradientEvent = grad_moms # add
Add following two line in to the Scanner.py, you can find it in the same path as before
def forward(self,spins,event_time,do_dummy_scans=False,compact_grad_tensor=True):
# ! init param
from core.SpinRecorder import SpinRecorder # add
recorder = SpinRecorder(self.NRep,self.T,event_time, self.flipEvent,self.gradientEvent,self.sz) # add
Add following lines in to the Scanner.py, you can find it in the same path as before
def forward(self,spins,event_time,do_dummy_scans=False,compact_grad_tensor=True):
### some code
for r in range(self.NRep): # for all repetitions
for t in range(self.T): # for all actions
##################
### Magic Math ###
##################
# pick up spin from high level Tensor
spin = spins.M[:,0,:,:,0]
# compute average M for Vox. and cover to numpy
spinTensor = (torch.sum(spin,[0])/self.NSpins).numpy()
recorder.addSpin(r,t,spinTensor)
recorder.printOut()
Make sure you using forward & set_gradient_precession_tensor_super in your sequence. Like show in below:
scanner.init_gradient_tensor_holder()
scanner.set_gradient_precession_tensor_super(gradm_event,rf_event) # refocusing=False for GRE/FID, adjust for higher echoes
## end S3: MR sequence definition ::: #####################################
#############################################################################
## S4: MR simulation forward process ::: #####################################
scanner.init_signal()
scanner.forward(spins, event_time)
You should find a Sequence.json file in Path:
--Your MRIPULSEQ Git Path--\