<commit_before>"""The qipipeline L{run} function is the OHSU QIN pipeline facade."""

import os, tempfile
from ..helpers import xnat_helper
from .pipeline_error import PipelineError
from . import staging
from . import registration as reg
from . import pk_mapping as pk

import logging
logger = logging.getLogger(__name__)

def run(collection, *subject_dirs, **opts):
    """
    Runs the OHSU QIN pipeline on the the given AIRC subject directories as follows:
        - Detects which AIRC visits have not yet been stored into XNAT
        - Groups the input DICOM images into series.
        - Fixes each input DICOM header for import into CTP.
        - Uploads the fixed DICOM file into XNAT.
        - Makes the CTP subject id map.
        - Stacks each new series as a NiFTI file using DcmStack.
        - Uploads each new series stack into XNAT.
        - Registers each new visit.
        - Uploads the resampled images into XNAT.
        - Performs a parameteric mapping on both the scanned and resampled images.
        - Uploads the parameteric mappings into XNAT.
    
    The supported AIRC collections are defined L{qipipe.staging.airc_collection}.

    The options include the workflows to run, as well as any additional
    L{QIPipeline.run} options.
    
    The destination directory is populated with the CTP import staging files.
    
    @param collection: the AIRC image collection name
    @param dest: the destination directory
    @param subject_dirs: the AIRC source subject directories to stage
    @param opts: additional workflow options
    """

    qip = QIPipeline(collection)
    return qip.run(*subject_dirs, **opts)
    <commit_msg>PEP8 white space.<commit_after>"""The qipipeline L{run} function is the OHSU QIN pipeline facade."""

import os, tempfile
from ..helpers import xnat_helper
from .pipeline_error import PipelineError
from . import staging
from . import registration as reg
from . import pk_mapping as pk

import logging
logger = logging.getLogger(__name__)


def run(collection, *subject_dirs, **opts):
    """
    Runs the OHSU QIN pipeline on the the given AIRC subject directories as follows:
        - Detects which AIRC visits have not yet been stored into XNAT
        - Groups the input DICOM images into series.
        - Fixes each input DICOM header for import into CTP.
        - Uploads the fixed DICOM file into XNAT.
        - Makes the CTP subject id map.
        - Stacks each new series as a NiFTI file using DcmStack.
        - Uploads each new series stack into XNAT.
        - Registers each new visit.
        - Uploads the resampled images into XNAT.
        - Performs a parameteric mapping on both the scanned and resampled images.
        - Uploads the parameteric mappings into XNAT.
    
    The supported AIRC collections are defined L{qipipe.staging.airc_collection}.

    The options include the workflows to run, as well as any additional
    L{QIPipeline.run} options.
    
    The destination directory is populated with the CTP import staging files.
    
    @param collection: the AIRC image collection name
    @param dest: the destination directory
    @param subject_dirs: the AIRC source subject directories to stage
    @param opts: additional workflow options
    """

    qip = QIPipeline(collection)
    return qip.run(*subject_dirs, **opts)

    
{'fraction_non_alphanumeric': 0.053057553956834536, 'fraction_numerical': 0.00029976019184652276, 'mean_word_length': 2.9351415094339623, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6413928', 'n_tokens_mistral': 949, 'n_tokens_neox': 900, 'n_words': 408}