新增脚本filename_regulation_generator.py,有命名规范需要修改时,只需要修改ConfigParams.py的Filename类里面的变量的值,之后直接运行脚本filename_regulation_generator.py即可获取最新版本的数据结构化输入和输出命名规范.html

This commit is contained in:
2025-05-28 22:04:49 +08:00
parent ee4df5ee93
commit 13cf749a99
17 changed files with 1083 additions and 908 deletions

View File

@ -0,0 +1,168 @@
<h1>文件命名规范</h1>
<h3>当一份数据被完整走完标注流程后,数据文件夹目录结构将会是:</h3>
<pre><code>.../Label/&lt;sampID&gt;
|-Artifact_a_采样率.txt
|-Artifact_b_采样率.txt
|-Artifact_c_采样率.csv
|-SQ_label_10s.csv
|-SQ_label_30s.csv
|-Resp_quality_label.txt
|-Tho_peak_采样率.txt
|-SA Label_corrected.csv
|-SA Label_add.csv
|-Precisely_Align_Info.txt
|-Approximately_Align_Info.csv
.../OrgBCG_Aligned/&lt;sampID&gt;
|-BCG_Sync_采样率.txt
|-OrgBCG_Sync_采样率.txt
|-Jpeak_Sync_采样率.txt
.../OrgBCG_Text/&lt;sampID&gt;
|-OrgBCG_Raw_采样率.txt
|-BCG_Filter_采样率.txt
|-Jpeak_revise_采样率.txt
|-Jpeak_revise_corrected_采样率.txt
.../OrgBCG_Origin/&lt;sampID&gt;
|-...
.../PSG_Aligned/&lt;sampID&gt;
|-ECG_Sync_采样率.txt
|-Rpeak_Sync_采样率.txt
|-5_class_Sync_采样率.txt
|-SA Label_Sync.csv
|-Effort Abd_Sync_采样率.txt
|-Effort Tho_Sync_采样率.txt
|-Flow T_Sync_采样率.txt
|-Flow P_Sync_采样率.txt
|-Snore_Sync_采样率.txt
|-SpO2_Sync_采样率.txt
.../PSG_Text/&lt;sampID&gt;
|-ECG II_Raw_采样率.txt
|-ECG_Filter_采样率.txt
|-Rpeak_final_采样率.txt
|-Rpeak_final_corrected_采样率.txt
|-5_class_Raw_采样率.txt
|-SA Label_Raw.csv
|-Effort Abd_Raw_采样率.txt
|-Effort Tho_Raw_采样率.txt
|-Flow T_Raw_采样率.txt
|-Flow P_Raw_采样率.txt
|-Snore_Raw_采样率.txt
|-SpO2_Raw_采样率.txt
|-StartTime_Raw.txt
.../PSG_Origin/&lt;sampID&gt;
|-...
.../Receive_Origin
|-...
.../Report
|-...
</code></pre>
<h3>1 数据粗同步</h3>
<p>输入:</p>
<p>原始OrgBCG信号<code>./OrgBCG_Text/&lt;sampID&gt;/OrgBCG_Raw_采样率.txt</code></p>
<p>原始Tho信号<code>./PSG_Text/&lt;sampID&gt;/Effort Tho_Raw_采样率.txt</code></p>
<p>原始Abd信号<code>./PSG_Text/&lt;sampID&gt;/Effort Abd_Raw_采样率.txt</code></p>
<p>输出:</p>
<p>粗同步后的位置索引:<code>./Label/&lt;sampID&gt;/Approximately_Align_Info.csv</code></p>
<h3>2 预处理</h3>
<p>输入:</p>
<p>原始OrgBCG信号<code>./OrgBCG_Text/&lt;sampID&gt;/OrgBCG_Raw_采样率.txt</code></p>
<p>原始ECG信号<code>./PSG_Text/&lt;sampID&gt;/ECG II_Raw_采样率.txt</code></p>
<p>输出:</p>
<p>滤波后的BCG信号<code>./OrgBCG_Text/&lt;sampID&gt;/BCG_Filter_采样率.txt</code></p>
<p>滤波后的ECG信号<code>./PSG_Text/&lt;sampID&gt;/ECG_Filter_采样率.txt</code></p>
<h3>3 数据精同步</h3>
<h4>3.1 算法定位</h4>
<h4>3.1.1 R峰算法定位</h4>
<p>输入:</p>
<p>滤波后的ECG信号<code>./PSG_Text/&lt;sampID&gt;/ECG_Filter_采样率.txt</code></p>
<p>输出:</p>
<p>算法定位的R峰坐标<code>./PSG_Text/&lt;sampID&gt;/Rpeak_final_采样率.txt</code></p>
<h4>3.1.2 J峰算法定位</h4>
<p>输入:</p>
<p>滤波后的BCG信号<code>./OrgBCG_Text/&lt;sampID&gt;/BCG_Filter_采样率.txt</code></p>
<p>输出:</p>
<p>算法定位的J峰坐标<code>./OrgBCG_Text/&lt;sampID&gt;/Jpeak_revise_采样率.txt</code></p>
<h4>3.2 人工纠正</h4>
<h4>3.2.1 R峰人工纠正</h4>
<p>输入:</p>
<p>滤波后的ECG信号<code>./PSG_Text/&lt;sampID&gt;/ECG_Filter_采样率.txt</code></p>
<p>算法定位的R峰坐标<code>./PSG_Text/&lt;sampID&gt;/Rpeak_final_采样率.txt</code></p>
<p>粗同步后的位置索引:<code>./Label/&lt;sampID&gt;/Approximately_Align_Info.csv</code></p>
<p>输出:</p>
<p>人工纠正后的R峰坐标<code>./PSG_Text/&lt;sampID&gt;/Rpeak_final_corrected_采样率.txt</code></p>
<h4>3.2.2 J峰人工纠正*</h4>
<p>输入:</p>
<p>滤波后的BCG信号<code>./OrgBCG_Text/&lt;sampID&gt;/BCG_Filter_采样率.txt</code></p>
<p>算法定位的J峰坐标<code>./OrgBCG_Text/&lt;sampID&gt;/Jpeak_revise_采样率.txt</code></p>
<p>粗同步后的位置索引:<code>./Label/&lt;sampID&gt;/Approximately_Align_Info.csv</code></p>
<p>输出:</p>
<p>人工纠正后的J峰坐标<code>./OrgBCG_Text/&lt;sampID&gt;/Jpeak_revise_corrected_采样率.txt</code></p>
<h4>3.3 数据片段起止对齐、数据采样率同步</h4>
<p>输入:</p>
<p>滤波后的ECG信号<code>./PSG_Text/&lt;sampID&gt;/ECG_Filter_采样率.txt</code></p>
<p>人工纠正后的R峰坐标<code>./PSG_Text/&lt;sampID&gt;/Rpeak_final_corrected_采样率.txt</code></p>
<p>滤波后的BCG信号<code>./OrgBCG_Text/&lt;sampID&gt;/BCG_Filter_采样率.txt</code></p>
<p>人工纠正后的J峰坐标<code>./OrgBCG_Text/&lt;sampID&gt;/Jpeak_revise_corrected_采样率.txt</code></p>
<p>原始OrgBCG信号<code>./OrgBCG_Text/&lt;sampID&gt;/OrgBCG_Raw_采样率.txt</code></p>
<p>粗同步后的位置索引:<code>./Label/&lt;sampID&gt;/Approximately_Align_Info.csv</code></p>
<p>输出:</p>
<p>精同步对齐信息:<code>./Label/&lt;sampID&gt;/Precisely_Align_Info.txt</code></p>
<p>同步后的ECG信号<code>./PSG_Aligned/&lt;sampID&gt;/ECG_Sync_采样率.txt</code></p>
<p>同步后的R峰坐标<code>./PSG_Aligned/&lt;sampID&gt;/Rpeak_Sync_采样率.txt</code></p>
<p>同步后的BCG信号<code>./OrgBCG_Aligned/&lt;sampID&gt;/BCG_Sync_采样率.txt</code></p>
<p>同步后的OrgBCG信号<code>./OrgBCG_Aligned/&lt;sampID&gt;/OrgBCG_Sync_采样率.txt</code></p>
<p>同步后的J峰坐标<code>./OrgBCG_Aligned/&lt;sampID&gt;/Jpeak_Sync_采样率.txt</code></p>
<h4>3.4、冗余数据切割、标签映射</h4>
<p>输入:</p>
<p>精同步对齐信息:<code>./Label/&lt;sampID&gt;/Precisely_Align_Info.txt</code></p>
<p>原始的Flow T信号<code>./PSG_Text/&lt;sampID&gt;/Flow T_Sync_采样率.txt</code></p>
<p>原始的Flow P信号<code>./PSG_Text/&lt;sampID&gt;/Flow P_Sync_采样率.txt</code></p>
<p>原始的Tho信号<code>./PSG_Text/&lt;sampID&gt;/Effort Tho_Sync_采样率.txt</code></p>
<p>原始的Abd信号<code>./PSG_Text/&lt;sampID&gt;/Effort Abd_Sync_采样率.txt</code></p>
<p>原始的SpO2信号<code>./PSG_Text/&lt;sampID&gt;/SpO2_Sync_采样率.txt</code></p>
<p>原始的Snore信号<code>./PSG_Text/&lt;sampID&gt;/Snore_Sync_采样率.txt</code></p>
<p>原始的睡眠分期标签:<code>./PSG_Text/&lt;sampID&gt;/5_class_Raw_采样率.txt</code></p>
<p>原始的睡眠呼吸暂停事件标签:<code>./PSG_Text/&lt;sampID&gt;/SA Label_Raw.csv</code></p>
<p>输出:</p>
<p>同步后的Flow T信号<code>./PSG_Aligned/&lt;sampID&gt;/Flow T_Sync_采样率.txt</code></p>
<p>同步后的Flow P信号<code>./PSG_Aligned/&lt;sampID&gt;/Flow P_Sync_采样率.txt</code></p>
<p>同步后的Tho信号<code>./PSG_Aligned/&lt;sampID&gt;/Effort Tho_Sync_采样率.txt</code></p>
<p>同步后的Abd信号<code>./PSG_Aligned/&lt;sampID&gt;/Effort Abd_Sync_采样率.txt</code></p>
<p>同步后的SpO2信号<code>./PSG_Aligned/&lt;sampID&gt;/SpO2_Sync_采样率.txt</code></p>
<p>同步后的Snore信号<code>./PSG_Aligned/&lt;sampID&gt;/Snore_Sync_采样率.txt</code></p>
<p>同步后的睡眠分期标签:<code>./PSG_Aligned/&lt;sampID&gt;/5_class_Sync_采样率.txt</code></p>
<p>同步后的睡眠呼吸暂停事件标签:<code>./PSG_Aligned/&lt;sampID&gt;/SA Label_Sync.csv</code></p>
<h3>4 体动标记</h3>
<p>输入:</p>
<p>同步后的BCG信号<code>./OrgBCG_Aligned/&lt;sampID&gt;/BCG_Sync_采样率.txt</code></p>
<p>同步后的OrgBCG信号<code>./OrgBCG_Aligned/&lt;sampID&gt;/OrgBCG_Sync_采样率.txt</code></p>
<p>输出:</p>
<p>txt格式的体动标签<code>./Label/&lt;sampID&gt;/Artifact_a_采样率.txt</code></p>
<p>体动标签类型数量统计:<code>./Label/&lt;sampID&gt;/Artifact_b_采样率.txt</code></p>
<p>csv格式的体动标签<code>./Label/&lt;sampID&gt;/Artifact_c_采样率.csv</code></p>
<h3>5 质量评估</h3>
<p>输入:</p>
<p>同步后的BCG信号<code>./OrgBCG_Aligned/&lt;sampID&gt;/BCG_Sync_采样率.txt</code></p>
<p>txt格式的体动标签<code>./Label/&lt;sampID&gt;/Artifact_a_采样率.txt</code></p>
<p>输出:</p>
<p>质量标签:<code>./Label/&lt;sampID&gt;/SQ_label_10s.csv</code><code>./Label/&lt;sampID&gt;/SQ_label_30s.csv</code></p>
<h3>6 呼吸提取</h3>
<p>输入:</p>
<p>同步后的OrgBCG信号<code>./OrgBCG_Aligned/&lt;sampID&gt;/OrgBCG_Sync_采样率.txt</code></p>
<p>同步后的Tho信号<code>./PSG_Aligned/&lt;sampID&gt;/Effort Tho_Sync_采样率.txt</code></p>
<p>txt格式的体动标签<code>./Label/&lt;sampID&gt;/Artifact_a_采样率.txt</code></p>
<p>输出:</p>
<p>呼吸可用性标签:<code>./Label/&lt;sampID&gt;/Resp_quality_label.txt</code></p>
<p>Tho信号呼吸间期标签<code>./Label/&lt;sampID&gt;/Tho_peak_采样率.txt</code></p>
<h3>8 呼吸暂停事件标注</h3>
<p>输入:</p>
<p>同步后的OrgBCG信号<code>./OrgBCG_Aligned/&lt;sampID&gt;/OrgBCG_Sync_采样率.txt</code></p>
<p>txt格式的体动标签<code>./Label/&lt;sampID&gt;/Artifact_a_采样率.txt</code></p>
<p>同步后的Flow T信号<code>./PSG_Aligned/&lt;sampID&gt;/Flow T_Sync_采样率.txt</code></p>
<p>同步后的Flow P信号<code>./PSG_Aligned/&lt;sampID&gt;/Flow P_Sync_采样率.txt</code></p>
<p>同步后的Tho信号<code>./PSG_Aligned/&lt;sampID&gt;/Effort Tho_Sync_采样率.txt</code></p>
<p>同步后的Abd信号<code>./PSG_Aligned/&lt;sampID&gt;/Effort Abd_Sync_采样率.txt</code></p>
<p>同步后的SpO2信号<code>./PSG_Aligned/&lt;sampID&gt;/SpO2_Sync_采样率.txt</code></p>
<p>同步后的睡眠呼吸暂停事件标签:<code>./PSG_Aligned/&lt;sampID&gt;/SA Label_Sync.csv</code></p>
<p>输出:</p>
<p>修正后的呼吸暂停标签:<code>./Label/&lt;sampID&gt;/SA Label_corrected.csv</code></p>
<p>新增的呼吸暂停标签:<code>./Label/&lt;sampID&gt;/SA Label_add.csv</code></p>