Unable to save data file to output filepath that contains a % character
还没有人认领这个 Issue。
评估
调研方向
首先使用 Python 示例复现报告的情况,然后检查 src/metaImage.cxx 中链接的路径处理代码附近的内容。跟踪在每个文件一个 slice 的输出中如何解释 %,并确定现有的测试覆盖情况(如果有)。当所请求的文件路径行为已实现或限制已记录,并且卷数据文件已按预期保存时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
As originally posted about in https://discourse.slicer.org/t/failures-saving-a-volume-to-path-with-sign/25657 and more specifically in
https://discourse.slicer.org/t/failures-saving-a-volume-to-path-with-sign/25657/6 thanks to @lassoan:
MetaIO supports One-Slice-Per-File Data Formats 1 and it uses the % character to specify the slice number in the filename format string.
Due to the special meaning of the % character, currently MetaIO does not allow using this chracter in the path. This limitation should either be clearly documented or the implementation should be made more sophisticated (to somehow differentiate the % that refers to per-slice filename generation from simple % occurrences in the path; or by allowing completely disabling this extremely rarely used one-slice-per-file feature).
As such, % used in the basename could possibly still be treated with the special meaning for the filename format string for One-Slice-Per-File functionality however, % used elsewhere in the filepath should be supported. Last resort would be to document this limitation.
The below code uses 3D Slicer to show that the mhd file is written for a volume output filepath that contains a "%", but the corresponding data file (.zraw) is not written.
import os
import SampleData
volume_node = SampleData.SampleDataLogic().downloadMRHead()
output_filepath = os.path.join(os.getenv("USERPROFILE"), "Downloads", "2%concentration", "MyVolume.mhd")
slicer.util.saveNode(volume_node, output_filepath)
print(f"{output_filepath} exists?: {os.path.exists(output_filepath)}")
raw_filepath = os.path.splitext(output_filepath)[0] + '.zraw' # default Slicer saves it compressed hence zraw and not raw
print(f"{raw_filepath} exists?: {os.path.exists(raw_filepath)}")
- 主要语言
- C
- 星标
- 32
- 派生
- 26
- 平均合并
- 2 小时 40 分钟
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Kitware/MetaIO 的其他 Issue
-
难度 5/5 一周以上 新手友好度 32/100
-
Update CI未关闭
难度 4/5 3-5 天 新手友好度 42/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 25/100
相似的 Issue
-
难度 2/5 半天 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 5 天内回复
-
constants.h: M_PI / M_PI_2 fallbacks cause -Wambiguous-macro when H3 is compiled as a Clang module未关闭
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
area:backend bug launch:p2 scope:core
难度 2/5 1-3 小时 新手友好度 62/100
Chelis-Lang/chelis#3494 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
zephyrproject-rtos/zephyr#121740 · 1 条评论 ·
维护者通常 2 天内回复