Skip to content

Instantly share code, notes, and snippets.

Avatar

Jacob Reinhold jcreinhold

View GitHub Profile
@jcreinhold
jcreinhold / normalize-ct-torch.py
Created Dec 9, 2021
normalize ct images in pytorch
View normalize-ct-torch.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Normalize the intensity of a CT image
Author: Jacob Reinhold
"""
import sys
from argparse import ArgumentParser
from pathlib import Path
from typing import Tuple, Union
@jcreinhold
jcreinhold / normalize-image-by-tissue.py
Created Dec 8, 2021
normalize one image by a rough estimate of tissue class mean
View normalize-image-by-tissue.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Normalize the intensity of an image by
finding a tissue mean in the foreground and
voxel-wise dividing the image by that value
Author: Jacob Reinhold
"""
import sys
from argparse import ArgumentParser
@jcreinhold
jcreinhold / normalize-tissue.py
Created Nov 23, 2021
normalize by tissue mean
View normalize-tissue.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Normalize the intensity of a set of images by
finding a tissue mean in the foreground and
voxel-wise dividing the image by that value
Author: Jacob Reinhold
"""
import os
import re
@jcreinhold
jcreinhold / normalize-mode.py
Created Nov 23, 2021
normalize intensity of images by dividing images of a specified intensity peak in histogram
View normalize-mode.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Normalize the intensity of a set of images by
finding a specified peak of each image foreground intensity
and voxel-wise dividing the image by that value
Author: Jacob Reinhold
"""
import os
import re
@jcreinhold
jcreinhold / normalize-percentile-foreground.py
Created Nov 23, 2021
normalize all images in a directory by the percentile of the estimated foreground
View normalize-percentile-foreground.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Normalize the intensity of a set of images by
finding the specified percentile of each image
foreground and voxel-wise dividing the image by that value
Author: Jacob Reinhold
"""
import os
import re
@jcreinhold
jcreinhold / normalize-percentile.py
Created Nov 23, 2021
divide the intensity of a set of medical images by the percentile of the dataset
View normalize-percentile.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Normalize the intensity of a set of images by
finding the median 99th percentile of all images
and dividing each image by that value
Author: Jacob Reinhold
"""
import os
import re
@jcreinhold
jcreinhold / normalize_ct.py
Last active Dec 8, 2021
Normalize CT images for a given tissue range
View normalize_ct.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Normalize the intensity of a CT image
Author: Jacob Reinhold
"""
import sys
from argparse import ArgumentParser
from pathlib import Path
from typing import Tuple, Union
@jcreinhold
jcreinhold / filter_with_fft.ipynb
Last active Sep 10, 2021
Filter in frequency w/ zero padding
View filter_with_fft.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jcreinhold
jcreinhold / example_tiramisu_brulee_predict.csv
Last active Jul 22, 2021
Example CSV for lesion-predict CLI in tiramisu-brulee
View example_tiramisu_brulee_predict.csv
subject flair pd t1 out
pred_subject_1 /path/to/flair_1.nii.gz /path/to/pd_1.nii.gz /path/to/t1_1.nii.gz /path/to/save/predicted_segmentation_1.nii.gz
pred_subject_2 /path/to/flair_2.nii.gz /path/to/pd_2.nii.gz /path/to/t1_2.nii.gz /path/to/save/predicted_segmentation_2.nii.gz
@jcreinhold
jcreinhold / example_tiramisu_brulee_train.csv
Last active Jul 22, 2021
Example CSV for lesion-train CLI in tiramisu-brulee
View example_tiramisu_brulee_train.csv
subject flair label pd t1
train_subject_1 /path/to/flair_1.nii.gz /path/to/ground_truth_segmentation_1.nii.gz /path/to/pd_1.nii.gz /path/to/t1_1.nii.gz
train_subject_2 /path/to/flair_2.nii.gz /path/to/ground_truth_segmentation_2.nii.gz /path/to/pd_2.nii.gz /path/to/t1_2.nii.gz