# 质控 ## Requirements - `os` - `pydicom == 2.3.0` - `numpy == 1.22.4` ## Overview 对产生的dcm格式图像文件进行质量控制,并且返回质控结果,当返回值是`SUCCESS`时,表示该图像通过质控,如果没有通过质控,则会返回失败原因。 1. 校验序列的tag:`Modality`是否为`CT`,`CTSR`或者`SRCT`。(不通过,返回`NOT_CT`) 2. 校验序列的层数是否大于等于30。(不通过,返回`LAYERCONUT_LESS`) 3. 校验序列的tag:`StudyDescription`/`SeriesDescription`/`BodyPartExamined`/`ProtocolName`中必须包含以下的某个字符串(`chest`、`thorax`、`lung`或者`nodule`)。(不通过,返回`MISS_SPECFIC_STR`) 4. 校验序列tag:`SliceThickness`必须大于0。(不通过,返回`MISS_SLICETHICKNESS`) 5. 校验序列tag:`Rows`需要等于tag:`Columns`,并且满足tag:`Rows`== 512 || tag:`Columns`== 1024。(不通过,返回`ROW_COLUMNS`) 6. 校验序列每层的人体坐标系是否为`{1.0, 0.0, 0.0, 0.0, 1.0, 0.0}`。(不通过,返回`IMAGEORIENTATIONPATIENT_CAUSE`) ## Usage 1. 可以直接调用`control_single`方法实现对单个图像的质控: ```python from quality_control import control_single target_path = 'path/to/dcms' result = control_single(target_path) if result == 'SUCCESS': print('该图像符合质控要求') ``` 2. 在深度学习任务中的`preprocess`模块,通过在`input_config.json`中将参数`if_qcontrol`设置为`true`,可以在预处理过程中实现质控,并且会删除质控不通过的图像。 ```python "if_qcontrol": true ```