The shape of the T1 image and the shape of the electric field are different
-
I used the IXI025-Guys-0852-T1 image for head segmentation and then performed TI (tissue imaging) simulation. However, I found that the shape of the T1 image and the shape of the electric field are different. My simulation grid setting is 1 mm. Why is this the case?
-
You don't have the same resolution (grid spacing) in the T1 image and the efield...!
To visualize the two "fields" on the same grid, drag the T1w image to the analysis explorer, and interpolate it on the e-field grid.The interpolator has two inputs:
- T1w image (input field)
- E-field (target grid)
Here is a snippet to show this could be done in Python
import s4l_v1.analysis as analysis import s4l_v1.document as document import s4l_v1.model as model # Add a new ModelToGridFilter inputs = [] model_to_grid_filter = analysis.core.ModelToGridFilter(inputs=inputs) model_to_grid_filter.Name = "Image" model_to_grid_filter.Entity = model.AllEntities()["T1w-image"] # The model entity corresponding to the T1w-image model_to_grid_filter.UpdateAttributes() # Add a new SimulationExtractor simulation = document.AllSimulations["EM"] simulation_extractor = simulation.Results() # Add a new EmSensorExtractor em_sensor_extractor = simulation_extractor["Overall Field"] em_sensor_extractor.FrequencySettings.ExtractedFrequency = u"All" # Add a new FieldInterpolationFilter inputs = [model_to_grid_filter.Outputs[""], em_sensor_extractor.Outputs["EM E(x,y,z,f0)"]] field_interpolation_filter = analysis.core.FieldInterpolationFilter(inputs=inputs) field_interpolation_filter.UpdateAttributes() document.AllAlgorithms.Add(field_interpolation_filter)
Then you will have the same grid and array ordering, and can overlay the T1w image and the field (or display them side by side with identical aspect ratio).
Note if your simulation grid is not uniform, matplotlib will depict the anatomy in a distorted way.
Btw, you could also interpolate in the other direction ... -
You don't have the same resolution (grid spacing) in the T1 image and the efield...!
To visualize the two "fields" on the same grid, drag the T1w image to the analysis explorer, and interpolate it on the e-field grid.The interpolator has two inputs:
- T1w image (input field)
- E-field (target grid)
Here is a snippet to show this could be done in Python
import s4l_v1.analysis as analysis import s4l_v1.document as document import s4l_v1.model as model # Add a new ModelToGridFilter inputs = [] model_to_grid_filter = analysis.core.ModelToGridFilter(inputs=inputs) model_to_grid_filter.Name = "Image" model_to_grid_filter.Entity = model.AllEntities()["T1w-image"] # The model entity corresponding to the T1w-image model_to_grid_filter.UpdateAttributes() # Add a new SimulationExtractor simulation = document.AllSimulations["EM"] simulation_extractor = simulation.Results() # Add a new EmSensorExtractor em_sensor_extractor = simulation_extractor["Overall Field"] em_sensor_extractor.FrequencySettings.ExtractedFrequency = u"All" # Add a new FieldInterpolationFilter inputs = [model_to_grid_filter.Outputs[""], em_sensor_extractor.Outputs["EM E(x,y,z,f0)"]] field_interpolation_filter = analysis.core.FieldInterpolationFilter(inputs=inputs) field_interpolation_filter.UpdateAttributes() document.AllAlgorithms.Add(field_interpolation_filter)
Then you will have the same grid and array ordering, and can overlay the T1w image and the field (or display them side by side with identical aspect ratio).
Note if your simulation grid is not uniform, matplotlib will depict the anatomy in a distorted way.
Btw, you could also interpolate in the other direction ...