Extract voxel information

Hi all

I need a way to export the voxel information to matlab, so I can mask out regions depending upon tissue type as part of my analysis. Specifically, I am looking at E field in the Duke model, but want to change the field in my plots in the bone to nan, to mask it out.

I think it should be possible to access the voxel information and do things with it in sim4life, and would appreciate a pointer int he right direction.



You can use the Mask Filter in Field Data Tools to mask an extracted field by Material, before exporting to Matlab.

So for example, you can specify a value (in your case NaN) to replace all the voxels which are currently assigned with Bone.

If you use the scripter, it will look something like this, with entities being defined as everything except the Bone material in your model you want to mask out:

			# Adding a new FieldMaskingFilter
			inputs = [convert_to_node_data_filter.Outputs["EM E(x,y,z,f0)"]]
			field_masking_filter = analysis.core.FieldMaskingFilter(inputs=inputs)

There's more info in the html manual here:
Data Analysis & Postprocessing > Field Data Tools > Mask Filter

Brilliant, exactly what I needed! Thanks so much.

I have implemented the filter to the data, but it does not get applied to the matlab export. I had the matlab export use the sensor output as an input previously, not sure how to make the input the output of the filter as all the things I have tried so far have not worked...

#make the mask
field_masking_filter = analysis.core.FieldMaskingFilter(inputs=inputs)

			outname = dirout+'\\'+sim.Name+'_masked.mat'
			outname.replace(" ","")
			outname = ''.join(outname.split())
			# Adding a new MatlabExporter but after the mask has been applied
			inputs = [field_masking_filter.GetOutput]
			matlab_exporter = analysis.exporters.MatlabExporter(inputs=inputs)

I figured it out, made it in the gui and used to python to see what the syntax had to be

			inputs = [field_masking_filter.Outputs["EM E(x,y,z,f0)"]]