> For the complete documentation index, see [llms.txt](https://docs.neuroinfodb.org/squirrel/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.neuroinfodb.org/squirrel/getting-started/squirrel-utilities/convert.md).

# convert

Convert DICOM or BIDS data into a squirrel package

## Overview

The `convert` tool creates a new squirrel package from a directory of DICOM files or from a BIDS dataset.

{% hint style="info" %}
`convert` replaces the older `dicom2squirrel` and `bids2squirrel` tools.

* `squirrel dicom2squirrel <indir> <package>` is now `squirrel convert <indir> <package> --inputformat dicom`
* `squirrel bids2squirrel <indir> <package>` is now `squirrel convert <indir> <package> --inputformat bids`
  {% endhint %}

## Usage

```bash
squirrel convert <inputdirectory> <package> --inputformat <bids|dicom> [options]
```

## Examples

Convert a directory of DICOM files. Imaging data is converted to the default Nifti 4D gz format, and the directory structure uses the original subject IDs and study/series numbers.

```bash
squirrel convert /path/to/dicoms outPackage.sqrl --inputformat dicom
```

Convert DICOM to uncompressed Nifti 4D, using sequentially numbered directories

```bash
squirrel convert /path/to/dicoms outPackage.sqrl --inputformat dicom --dataformat nifti4d --dirformat seq
```

Convert a BIDS dataset, overwriting any existing package with the same name

```bash
squirrel convert /path/to/bids outPackage.sqrl --inputformat bids --overwrite
```

## Options

<table data-full-width="true"><thead><tr><th width="240">Option</th><th>Description</th></tr></thead><tbody><tr><td><code>--inputformat &#x3C;format></code></td><td><strong>Required.</strong> Format of the input directory: <code>dicom</code> or <code>bids</code>.</td></tr><tr><td><code>--outputformat &#x3C;format></code></td><td>Output format. Only <code>squirrel</code> is supported, which is the default.</td></tr><tr><td><code>--dataformat &#x3C;format></code></td><td>Format of the imaging data written to the package, for DICOM input only (ignored for BIDS). <code>anon</code> (anonymized DICOM), <code>nifti4d</code>, <code>nifti4dgz</code> (default), <code>nifti3d</code>, <code>nifti3dgz</code>. See <a href="/squirrel/specifications/dicom-anonymization.md">DICOM anonymization</a>.</td></tr><tr><td><code>--dirformat &#x3C;format></code></td><td>Package directory structure. <code>orig</code> (original subject ID and study/series numbers, default) or <code>seq</code> (sequentially numbered).</td></tr><tr><td><code>--overwrite</code></td><td>Overwrite an existing package with the same name.</td></tr><tr><td><code>-q</code>, <code>--quiet</code></td><td>Don't print headers and checks.</td></tr><tr><td><code>-d</code>, <code>--debug</code></td><td>Enable debugging output.</td></tr><tr><td><code>--debugsql</code></td><td>Enable debugging of SQL statements.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.neuroinfodb.org/squirrel/getting-started/squirrel-utilities/convert.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
