Metadata-Version: 2.1
Name: fw_gear_petsurfer_mc
Version: 0.1.5
Summary: 
Home-page: https://gitlab.com/flywheel-io/scientific-solutions/gears/petsurfer-mc
License: MIT
Keywords: Flywheel,Gears
Author: Flywheel
Author-email: support@flywheel.io
Requires-Python: >=3.10,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Dist: flywheel-gear-toolkit (>=0.6,<0.7)
Requires-Dist: flywheel-sdk (>=19.3,<20.0)
Requires-Dist: fw-meta (==2.1.1)
Requires-Dist: matplotlib (>=3.6.2,<4.0.0)
Requires-Dist: nibabel (>=5.3.2,<6.0.0)
Requires-Dist: numpy (>=1.26.4,<2.0.0)
Requires-Dist: packaging (==20.4)
Requires-Dist: pandas (>=2.2.2,<3.0.0)
Requires-Dist: pytz (>=2022.6,<2023.0)
Requires-Dist: requests-toolbelt (>=1.0,<2.0)
Requires-Dist: seaborn (>=0.12.1,<0.13.0)
Project-URL: Repository, https://gitlab.com/flywheel-io/scientific-solutions/gears/petsurfer-mc
Description-Content-Type: text/markdown

# petsurfer-mc

## Overview

### Summary

*Motion correction of PET volumes (Petsurfer pipeline).*

### Cite

*https://surfer.nmr.mgh.harvard.edu/fswiki/PetSurfer*
*Other*

### Classification

*Category:* *analysis*

*Gear Level:*

- [ ] Project
- [ ] Subject
- [X] Session
- [ ] Acquisition
- [ ] Analysis

----

[[_TOC_]]

----

### Inputs

- *petfile*
  - __Name__: *petfile*
  - __Type__: *nifti*
  - __Optional__: *false*
  - __Classification__: *PT*
  - __Description__: *Input NIfTI file for the Motion correction*

### Config

- *debug*
  - __Name__: *debug*
  - __Type__: *string*
  - __Description__: *Log debug messages.*
  - __Default__: *false*

- *freeview_license_key*
  - __Name__: *freeview_license_key*
  - __Type__: *string*
  - __Description__: *Text from license file generated during FreeSurfer registration. Entries should be space separated.*
  - __Default__: **

- *frame_pattern*
  - __Name__: *frame_pattern*
  - __Type__: *string*
  - __Description__: *Text regular expression that will be used to get the frames to be aligned. For example if the pattern will be '^(ID01|Frame)$', the gear will look for ID01 and Frame to get the PET volumes for the template creation. It is case Insensitive.*
  - __Default__: *false*

- *template_creation*
  - __Name__: *template_creation*
  - __Type__: *string*
  - __Description__: *Select a method for PET template creation that will be used as target image for motion correction of PET dynamic volumes. The template can be generated by extracting a single frame ('sinlge_frame') or averaging all the time frames together ('mean').*
  - __Default__: **

- *ref_frame*
  - __Name__: *ref_frame*
  - __Type__: *string*
  - __Description__: *If the PET data only have one frame (eg, an uptake image), then that will be the template. If the PET data has multiple frames (ie, dynamic), then the template will be created from the dynamic data. In this case, this option can be used to specify which frame will be used as reference.*
  - __Default__: "0"

### Outputs

#### Files

*Average PET volume*

- **_avg.nii.g*
  - __Name__: **_avg.nii.gz*
  - __Type__: *nifti*
  - __Optional__: **
  - __Classification__: **
  - __Description__: *Averaged PET volumes compute after intra-subject motion correction process.*
  - __Notes__: *This file will be used as template space for coregistration (petsurfer-coreg).*

*Motion correction parameters*

- **_avg.dat*
  - __Name__: **_avg.dat*
  - __Type__: *dat*
  - __Optional__: *false*
  - __Classification__: **
  - __Description__: *data file including motion correction parameters*


*Plots of motion correction parameters (displacement and rotation)*

- *displacement and rotation*
  - __Name__: * mc_displacement.png,  mc_rotation.png*
  - __Type__: *png*
  - __Optional__: *false*
  - __Classification__: **
  - __Description__: *Plots for visualize displacement and rotation corrections.*
  - __Notes__: *For QC usage.*


#### Metadata

Motion correction metadata (mean and variance) are store as custom information on the Analysis container. Dataview
can be used to report on those metrics.

### Pre-requisites

None

#### Prerequisite Gear Runs

None

#### Prerequisite Files

None

#### Prerequisite Metadata

None

## Usage

### Description

*This gear will get the PET volumes converted by dcm2nxx and run the motion correction process to correct for displacement and rotations occurred during the acquisition. The average PET volume is computed and used as reference template for the PetSurfer pipeline.  *

#### File Specifications

This section contains specifications on any input files that the gear may need

##### *{Input-File}*

A description of the input file

### Workflow


Description of workflow

1. Upload file to container
1. Set up the gear rules
1. Geat places output in Analysis

### Use Cases

#### Use Case 1

__*Conditions__*:

- [ ] Possibly a list of check boxes indicating things that are absent
- [x] and things that are present

*There are no use cases. This gear will run upon setting the gear rules at project level.*

### Logging

It throws the log from the registration system.

## FAQ

[FAQ.md](FAQ.md)

## Contributing

[For more information about how to get started contributing to that gear,
checkout [CONTRIBUTING.md](CONTRIBUTING.md).]
<!-- markdownlint-disable-file -->

