Skip to content
This repository has been archived by the owner on Jul 29, 2023. It is now read-only.

Flatfield correction and metadata #150

Merged
merged 81 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
ce68444
fixed generate meta tests
jennyfolkesson Mar 23, 2022
1878432
fixed inference script tests
jennyfolkesson Mar 23, 2022
0ab47c7
fixed metrics tests
jennyfolkesson Mar 23, 2022
a06fb47
fixed preprocessing (masks, tile, mp aux)
jennyfolkesson Mar 24, 2022
0d80acc
fixed evaluation metrics tests
jennyfolkesson Mar 28, 2022
2c318c1
lots of issues with inference. fixed 2d so far
jennyfolkesson Mar 28, 2022
6199df3
fixed 2.5d inference, still working on 3d
jennyfolkesson Mar 30, 2022
b3ac26c
3 remaining errors in 3d inference
jennyfolkesson Mar 31, 2022
93f3be3
debugging 3d inference
jennyfolkesson Apr 2, 2022
228b7fd
debugging 3d inference
jennyfolkesson Apr 2, 2022
389326a
debugging 3d inference, fixed overlap shape
jennyfolkesson Apr 2, 2022
61eedd2
fixed 5d tiling bug
jennyfolkesson Apr 3, 2022
e75e0da
fixed 3d inference!
jennyfolkesson Apr 3, 2022
0284026
fixed stitch tests
jennyfolkesson Apr 11, 2022
9906ea2
fixed dataset tests
jennyfolkesson Apr 11, 2022
0d88eb4
fixed dataset w mask tests
jennyfolkesson Apr 11, 2022
66679c8
fixed inference dataset tests
jennyfolkesson Apr 11, 2022
ce3cbb7
fixed plot utils tests
jennyfolkesson Apr 11, 2022
f7b3bbf
added flatfield tests
jennyfolkesson Apr 11, 2022
913961f
fixed gen mask tests
jennyfolkesson Apr 11, 2022
4626f20
working on tiling tests
jennyfolkesson Apr 11, 2022
e633484
fixed tile nonuni tests
jennyfolkesson Apr 12, 2022
0bf4c9a
fixed uniform tile tests
jennyfolkesson Apr 12, 2022
49a7a64
fixed aux utils tests
jennyfolkesson Apr 12, 2022
0c2ee0f
debugging image utils
jennyfolkesson Apr 12, 2022
08630be
updated pandas version to avoid attribute error in pandas
jennyfolkesson Apr 14, 2022
ea87b85
fixed image utils tests
jennyfolkesson Apr 14, 2022
1ce6a24
fixed mask utils tests
jennyfolkesson Apr 14, 2022
ed79854
fixed mp utils tests
jennyfolkesson Apr 14, 2022
9fcea41
debugging tile utils
jennyfolkesson Apr 14, 2022
cccd3e7
fixed tile utils tests
jennyfolkesson Apr 18, 2022
76e2da6
newer mpl version
jennyfolkesson Apr 18, 2022
c19b380
updated skimage, debugging flatfield
jennyfolkesson Apr 18, 2022
8b9d2fe
sort output of os.listdir
jennyfolkesson Apr 18, 2022
30cc5bb
initial work on moving intensity computations
jennyfolkesson Apr 25, 2022
b18da84
added metadata check in preprocessing script
jennyfolkesson Apr 26, 2022
246133b
adding tests for intensity meta
jennyfolkesson Apr 26, 2022
4678ce8
simplified ints_meta_generator, added test
jennyfolkesson Apr 27, 2022
0b597e3
debugging preprocessing tests
jennyfolkesson Apr 27, 2022
e834cfe
fixed preprocess tests
jennyfolkesson Apr 27, 2022
2aca71f
added mp utils test
jennyfolkesson Apr 27, 2022
cc2a76f
adding meta utils tests
jennyfolkesson Apr 27, 2022
e7817b8
adding meta tests
jennyfolkesson Apr 28, 2022
e7925b1
debugging zscore test
jennyfolkesson Apr 28, 2022
09cca35
fixed zscore test
jennyfolkesson May 2, 2022
0b4ec54
added preprocessing tests for meta gen and norm
jennyfolkesson May 2, 2022
74059c6
f
jennyfolkesson May 2, 2022
59d599a
Master tests (#149)
jennyfolkesson May 10, 2022
3116a19
fixed inference script tests
jennyfolkesson Mar 23, 2022
d6a6eb0
fixed metrics tests
jennyfolkesson Mar 23, 2022
310e14f
fixed preprocessing (masks, tile, mp aux)
jennyfolkesson Mar 24, 2022
cb90051
fixed evaluation metrics tests
jennyfolkesson Mar 28, 2022
a3128c5
lots of issues with inference. fixed 2d so far
jennyfolkesson Mar 28, 2022
73aa1e3
fixed 2.5d inference, still working on 3d
jennyfolkesson Mar 30, 2022
4103114
3 remaining errors in 3d inference
jennyfolkesson Mar 31, 2022
5e20ace
debugging 3d inference
jennyfolkesson Apr 2, 2022
92feb4f
debugging 3d inference
jennyfolkesson Apr 2, 2022
dba0179
debugging 3d inference, fixed overlap shape
jennyfolkesson Apr 2, 2022
4141c96
fixed 5d tiling bug
jennyfolkesson Apr 3, 2022
6dc06cb
fixed 3d inference!
jennyfolkesson Apr 3, 2022
33f1976
working on tiling tests
jennyfolkesson Apr 11, 2022
e66e89e
fixed aux utils tests
jennyfolkesson Apr 12, 2022
9ac375e
updated skimage, debugging flatfield
jennyfolkesson Apr 18, 2022
aef9fbd
sort output of os.listdir
jennyfolkesson Apr 18, 2022
30ae829
initial work on moving intensity computations
jennyfolkesson Apr 25, 2022
200532b
added metadata check in preprocessing script
jennyfolkesson Apr 26, 2022
533a469
adding tests for intensity meta
jennyfolkesson Apr 26, 2022
cbeea6a
simplified ints_meta_generator, added test
jennyfolkesson Apr 27, 2022
74ea8f4
debugging preprocessing tests
jennyfolkesson Apr 27, 2022
c8b75b4
fixed preprocess tests
jennyfolkesson Apr 27, 2022
715d50c
added mp utils test
jennyfolkesson Apr 27, 2022
fa80048
adding meta utils tests
jennyfolkesson Apr 27, 2022
60c83e5
adding meta tests
jennyfolkesson Apr 28, 2022
65259a8
debugging zscore test
jennyfolkesson Apr 28, 2022
affdfed
fixed zscore test
jennyfolkesson May 2, 2022
bd20226
added preprocessing tests for meta gen and norm
jennyfolkesson May 2, 2022
a4e14ba
updated docstring
jennyfolkesson May 11, 2022
bb868fc
merged
jennyfolkesson May 11, 2022
c29472b
switched from None to NaN due to efficiency in pandas
jennyfolkesson May 16, 2022
bab757d
smguo feedback
jennyfolkesson May 31, 2022
99bcd1d
trying to fix protocol error
jennyfolkesson May 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://github.com/czbiohub/microDL/workflows/build/badge.svg)]
![Build Status](https://github.com/czbiohub/microDL/workflows/build/badge.svg)
[![Code Coverage](https://codecov.io/gh/czbiohub/microDL/branch/master/graphs/badge.svg)](https://codecov.io/gh/czbiohub/microDL)

# microDL
Expand Down
2 changes: 1 addition & 1 deletion micro_dl/cli/dataset_pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def pool_dataset(config):
num_workers = pool_config['num_workers']
pool_mode = pool_config['pool_mode']
frames_meta_dst_path = os.path.join(dst_dir, 'frames_meta.csv')
ints_meta_dst_path = os.path.join(dst_dir, 'ints_meta.csv')
ints_meta_dst_path = os.path.join(dst_dir, 'intensity_meta.csv')
pos_idx_cur = 0
os.makedirs(dst_dir, exist_ok=True)
if os.path.exists(frames_meta_dst_path) and pool_mode == 'add':
Expand Down
47 changes: 37 additions & 10 deletions micro_dl/cli/generate_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def parse_args():
default=4,
help="number of workers for multiprocessing",
)
parser.add_argument(
'--block_size',
type=int,
default=256,
help="Pixel block size for intensity sampling",
)
parser.add_argument(
'--normalize_im',
type=str,
Expand All @@ -46,19 +52,40 @@ def parse_args():


def main(parsed_args):
meta_utils.frames_meta_generator(parsed_args.input,
parsed_args.order,
parsed_args.name_parser,
)
"""
Generate metadata for each file by interpreting the file name.
Writes found data in frames_metadata.csv in input directory.
Assumed default file naming convention is:
dir_name
|
|- im_c***_z***_t***_p***.png
|- im_c***_z***_t***_p***.png

c is channel
z is slice in stack (z)
t is time
p is position (FOV)

Other naming convention is:
img_channelname_t***_p***_z***.tif for parse_sms_name

:param argparse parsed_args: Input arguments
"""
# Collect metadata for all image files
meta_utils.frames_meta_generator(
input_dir=parsed_args.input,
order=parsed_args.order,
name_parser=parsed_args.name_parser,
)
# Compute intensity stats for all images
if parsed_args.normalize_im in ['dataset', 'volume', 'slice']:
meta_utils.ints_meta_generator(parsed_args.input,
parsed_args.order,
parsed_args.name_parser,
parsed_args.num_workers,
)
meta_utils.ints_meta_generator(
input_dir=parsed_args.input,
num_workers=parsed_args.num_workers,
block_size=parsed_args.block_size,
)


if __name__ == '__main__':
parsed_args = parse_args()
main(parsed_args)

1 change: 0 additions & 1 deletion micro_dl/cli/inference_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def run_inference(config_fname,
inference_inst.run_prediction()



if __name__ == '__main__':
args = parse_args()
# Get GPU ID and memory fraction
Expand Down
3 changes: 2 additions & 1 deletion micro_dl/cli/metrics_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ def compute_metrics(model_dir,
(see evaluation_metrics)
:param bool test_data: Uses test indices in split_samples.json,
otherwise all indices
:param str name_parser: Type of name parser (default or parse_idx_from_name)
"""
# Load config file
config_name = os.path.join(model_dir, 'config.yml')
with open(config_name, 'r') as f:
config = yaml.safe_load(f)

preprocess_config = preprocess_utils.get_preprocess_config(config['dataset']['data_dir'])
# Load frames metadata and determine indices
frames_meta = pd.read_csv(os.path.join(image_dir, 'frames_meta.csv'))
Expand All @@ -117,7 +119,6 @@ def compute_metrics(model_dir,
else:
test_ids = np.sort(np.unique(frames_meta[split_idx_name]))


# Find other indices to iterate over than split index name
# E.g. if split is position, we also need to iterate over time and slice
test_meta = pd.read_csv(os.path.join(model_dir, 'test_metadata.csv'))
Expand Down
Loading