# Path: dicom2nifti/exceptions.py
# class ConversionError(Exception):
#     """
#     Custom error type to distinguish between know validations and script errors
#     """
# 
#     def __init__(self, message):
#         # Call the base class constructor with the parameters it needs
#         super(ConversionError, self).__init__(message)
# 
# class ConversionValidationError(Exception):
#     """
#     Custom error type to distinguish between know validations and script errors
#     """
# 
#     def __init__(self, message):
#         # Call the base class constructor with the parameters it needs
#         super(ConversionValidationError, self).__init__(message)


import os
import traceback
import logging
import nibabel
import numpy
import pydicom.config as pydicom_config
import dicom2nifti.common as common
import dicom2nifti.settings as settings
import dicom2nifti.convert_generic as convert_generic
from pydicom.tag import Tag
from dicom2nifti.exceptions import ConversionError, ConversionValidationError

        return {'NII_FILE': output_file,
                'BVAL_FILE': bval_file,
                'BVEC_FILE': bvec_file,
                'NII': nii_image,
                'BVAL': bval,
                'BVEC': bvec,
                'MAX_SLICE_INCREMENT': slice_increment}

    return {'NII_FILE': output_file,
            'NII': nii_image,
            'MAX_SLICE_INCREMENT': slice_increment}


def _singleframe_to_block(grouped_dicoms):
    """
    Generate a full datablock containing all timepoints
    """
    # For each slice / mosaic create a data volume block
    data_blocks = []
    for index in range(0, len(grouped_dicoms)):
        logger.info('Creating block %s of %s' % (index + 1, len(grouped_dicoms)))
        current_block = _stack_to_block(grouped_dicoms[index])
        current_block = current_block[:, :, :, numpy.newaxis]
        data_blocks.append(current_block)

    try:
        full_block = numpy.concatenate(data_blocks, axis=3)
    except:
        traceback.print_exc()

# Path: dicom2nifti/exceptions.py
# class ConversionError(Exception):
#     """
#     Custom error type to distinguish between know validations and script errors
#     """
# 
#     def __init__(self, message):
#         # Call the base class constructor with the parameters it needs
#         super(ConversionError, self).__init__(message)
# 
# class ConversionValidationError(Exception):
#     """
#     Custom error type to distinguish between know validations and script errors
#     """
# 
#     def __init__(self, message):
#         # Call the base class constructor with the parameters it needs
#         super(ConversionValidationError, self).__init__(message)


# Path: dicom2nifti/convert_philips.py
import os
import traceback
import logging
import nibabel
import numpy
import pydicom.config as pydicom_config
import dicom2nifti.common as common
import dicom2nifti.settings as settings
import dicom2nifti.convert_generic as convert_generic
from pydicom.tag import Tag
from dicom2nifti.exceptions import ConversionError, ConversionValidationError


        return {'NII_FILE': output_file,
                'BVAL_FILE': bval_file,
                'BVEC_FILE': bvec_file,
                'NII': nii_image,
                'BVAL': bval,
                'BVEC': bvec,
                'MAX_SLICE_INCREMENT': slice_increment}

    return {'NII_FILE': output_file,
            'NII': nii_image,
            'MAX_SLICE_INCREMENT': slice_increment}


def _singleframe_to_block(grouped_dicoms):
    """
    Generate a full datablock containing all timepoints
    """
    # For each slice / mosaic create a data volume block
    data_blocks = []
    for index in range(0, len(grouped_dicoms)):
        logger.info('Creating block %s of %s' % (index + 1, len(grouped_dicoms)))
        current_block = _stack_to_block(grouped_dicoms[index])
        current_block = current_block[:, :, :, numpy.newaxis]
        data_blocks.append(current_block)

    try:
        full_block = numpy.concatenate(data_blocks, axis=3)
    except:
        traceback.print_exc()

        raise ConversionError("MISSING_DICOM_FILES")