You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if you could make a small change to the neuromaps.parcellate.Parcellater class to make the resampled parcellation (if resampling_target = data) accessible from outside of the class?
Example:
# initiate the class with some volumetric parcellation with 1mm voxelsize: "parc_1mm"parcellater=neuromaps.parcellate.Parcellater(
parcellation=parc_1mm,
space="MNI152",
resampling_target="data"
).fit()
# apply to a file with 3mm voxelsize: "file_3mm"parcellated_data=parcellater.transform(
data=file_3mm,
space="MNI152"
)
# internally, this will resample the parcellation to 3mm voxelsize (line 155), # but the resampled parcellation remains a local variable. # I would like to access it, e.g. as an instance variableparc_3mm=parcellater._parc
I obviously can work around by doing the resampling before calling Parcellater or by modifying your code directly. But I would like to incorporate your methods in a tool of my own and it would be more elegant that way. :)
Specifically, I want to access the resampled parcellation to identify parcels that became too small after resampling or dont contain any data. This can lead to cases in which the nilearn masker that you use internally just drops parcels from the output. To then map the output to the parcel indices and fill in the dropped parcels with nan values, I have to check which parcel indices are actually missing in the resampled parcellation (i.e., comparing np.unique(parc_1mm.get_fdata()) with np.unique(parc_3mm.get_fdata()). I hope that was understandable :D .
Thanks a lot!
Best wishes, Leon
Code of Conduct
I agree to follow the neuromaps Code of Conduct
The text was updated successfully, but these errors were encountered:
Description of issue
Hi folks,
I was wondering if you could make a small change to the
neuromaps.parcellate.Parcellater
class to make the resampled parcellation (ifresampling_target = data
) accessible from outside of the class?Example:
I obviously can work around by doing the resampling before calling
Parcellater
or by modifying your code directly. But I would like to incorporate your methods in a tool of my own and it would be more elegant that way. :)Specifically, I want to access the resampled parcellation to identify parcels that became too small after resampling or dont contain any data. This can lead to cases in which the nilearn masker that you use internally just drops parcels from the output. To then map the output to the parcel indices and fill in the dropped parcels with nan values, I have to check which parcel indices are actually missing in the resampled parcellation (i.e., comparing
np.unique(parc_1mm.get_fdata())
withnp.unique(parc_3mm.get_fdata())
. I hope that was understandable :D .Thanks a lot!
Best wishes, Leon
Code of Conduct
neuromaps
Code of ConductThe text was updated successfully, but these errors were encountered: