Skip to content

Add gzip compression option for tar archives#56

Merged
akhanf merged 5 commits intomasterfrom
copilot/add-gzip-option-to-tar
Feb 25, 2026
Merged

Add gzip compression option for tar archives#56
akhanf merged 5 commits intomasterfrom
copilot/add-gzip-option-to-tar

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 11, 2026

Adds optional gzip compression for tar archives to reduce storage footprint, particularly beneficial for non-Enhanced MR DICOMs.

Changes

CLI: New --gzip flag creates .tar.gz files instead of .tar

cfmm2tar --gzip -d '20240101' output_dir

API: Added use_gzip parameter to download_studies() and download_studies_from_metadata()

from cfmm2tar.api import download_studies
download_studies(output_dir="/path/to/output", use_gzip=True)

Core: Modified DicomSorter.tar() to use tarfile gzip mode when enabled

  • Creates .tar.gz and .attached.tar.gz files
  • Refactored attached tar logic to collect items before writing (gzip doesn't support append mode)
  • Updated .uid file generation to handle both extensions

Backward compatibility: Defaults to False throughout. Existing workflows unchanged.

Original prompt

This section details on the original issue you should resolve

<issue_title>gzip the tarballs</issue_title>
<issue_description>What do you guys think about providing an option to gzip the tar files? Will save some space, especially for old-school non-Enhanced MR DICOMs.</issue_description>

<agent_instructions>add an option to cfmm2tar (api and cli) to provide gzipped tar files instead of regular tar files</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@akhanf Ya I think that’s a good idea.. I think the downstream scripts (e.g. tar2bids) should still work with tar.gz files too anyways.. Can add the same flag perhaps to dicom2tar as well..

On Oct 17, 2018, at 3:06 PM, isolovey-robarts <notifications@github.commailto:notifications@github.com> wrote:

What do you guys think about providing an option to gzip the tar files? Will save some space, especially for old-school non-Enhanced MR DICOMs.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub#4, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AK9dXavAG1hbDcdgHy7ZIv776p-Ar6BNks5ul3-ygaJpZM4XlAIK.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 11, 2026 20:35
Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
Co-authored-by: akhanf <11492701+akhanf@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to gzip tar files for space saving Add gzip compression option for tar archives Feb 11, 2026
Copilot AI requested a review from akhanf February 11, 2026 20:42
@akhanf akhanf marked this pull request as ready for review February 15, 2026 13:52
@akhanf
Copy link
Copy Markdown
Member

akhanf commented Feb 25, 2026

tested this and works

@akhanf akhanf merged commit 92a3859 into master Feb 25, 2026
2 checks passed
@akhanf akhanf deleted the copilot/add-gzip-option-to-tar branch February 25, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gzip the tarballs

2 participants