Download data/code/UWphoto_script_mriSegPhotoOverlay.m from introvoyz041/DissectionPhotoVolumes: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/datasets/introvoyz041/DissectionPhotoVolumes/resolve/main/data/code/UWphoto_script_mriSegPhotoOverlay.m
- Command line
-
hf download hf://datasets/introvoyz041/DissectionPhotoVolumes/data/code/UWphoto_script_mriSegPhotoOverlay.m
-
curl -L -o UWphoto_script_mriSegPhotoOverlay.m https://huggingface.co/datasets/introvoyz041/DissectionPhotoVolumes/resolve/main/data/code/UWphoto_script_mriSegPhotoOverlay.m
1.36 kB
| % Script to overlay the samseg segmentations of the ex-vivo MRI volumes on | |
| % to the Hard registered photo volumes. | |
| %% setup directories | |
| MRIseg_directory = '/home/henry/Documents/Brain/UWphoto/FLAIR_Scan_Data/SAMSEG'; | |
| Photo_directory = '/home/henry/Documents/Brain/UWphoto/Results_hard'; | |
| %% get file list | |
| % get list of warped references used for headers | |
| dlist_photos = dir(fullfile(Photo_directory,'*/*.warped_ref.mgz')); | |
| %% work through files | |
| for il = 1:length(dlist_photos) | |
| %% get matching segmentation | |
| [~,brainID,~] = fileparts(dlist_photos(il).folder); | |
| brainID_conv = strrep(brainID,'-','_'); | |
| dlist_mrSamSeg = dir(fullfile(MRIseg_directory,... | |
| ['*',brainID_conv,'/*_crispSegmentation.nii'])); | |
| outfile = fullfile(dlist_photos(il).folder,... | |
| [brainID,'.hard.warped_seg.mgz']); | |
| %% read in volumes | |
| photo_ref = MRIread(fullfile(dlist_photos(il).folder,... | |
| dlist_photos(il).name)); | |
| mri_seg = MRIread(fullfile(dlist_mrSamSeg.folder,dlist_mrSamSeg.name)); | |
| % transfer header information from photo volumes to output segmentation | |
| photo_seg = photo_ref; | |
| %% output warped segmentation | |
| % transfer mri segmentation voxel data to output segmentation | |
| photo_seg.vol = mri_seg.vol; | |
| MRIwrite(photo_seg,outfile); | |
| end | |