import os
import nipype
from nipype.interfaces.base import (traits, TraitedSpec)
from .DockerInterface import *

class SetOrigintoACInputSpec(DockerInputSpec):
    vol = DockerFile(desc="volume to process",
                      argstr='--vol %s',
                      mandatory=True,
                      exist=True)
    MNIbrain_template = DockerFile(desc="MNIbrain_template",
                      argstr='--MNIbrain_template %s',
                      mandatory=True,
                      exist=True)
    AC_coords_MNI = DockerFile(desc="AC_coords_MNI",
                      argstr='--AC_coords_MNI %s',
                      mandatory=True,
                      exist=True)
    BETfrac = traits.Float(desc="BETfrac",
                      argstr='--BETfrac %s',
                      mandatory=False,
                      default = 0.5)
    reg_cost = traits.Str(desc="reg_cost",
                      argstr='--reg_cost %s',
                      mandatory=False,
                      default = "mutualinfo")
    vol_name = traits.Str(desc="vol_name",
                      argstr='--vol_name %s',
                      mandatory=False,
                      default = "T1")


class SetOrigintoACOutputSpec(TraitedSpec):
    output_file = DockerFile(desc = "volume processed")


class SetOrigintoAC(DockerInterface):
    input_spec = SetOrigintoACInputSpec
    output_spec = SetOrigintoACOutputSpec
    container_cmd = "python app/SetOrigintoACbet.py"
    docker_image = "set_origin_to_ac"

    def _list_outputs(self):
        outputs = self.output_spec().get()
        inputs = self.inputs.get()
        outputs['output_file'] = os.path.join(os.getcwd(), "T1/T1_oc.nii")
        return outputs

import os
import nipype
from nipype.interfaces.base import (traits, TraitedSpec)
from .DockerInterface import *

class SetOrigintoACInputSpec(DockerInputSpec):
    vol = DockerFile(desc="volume to process",
                      argstr='--vol %s',
                      mandatory=True,
                      exist=True)
    MNIbrain_template = DockerFile(desc="MNIbrain_template",
                      argstr='--MNIbrain_template %s',
                      mandatory=True,
                      exist=True)
    AC_coords_MNI = DockerFile(desc="AC_coords_MNI",
                      argstr='--AC_coords_MNI %s',
                      mandatory=True,
                      exist=True)
    BETfrac = traits.Float(desc="BETfrac",
                      argstr='--BETfrac %s',
                      mandatory=False,
                      default = 0.5)
    reg_cost = traits.Str(desc="reg_cost",
                      argstr='--reg_cost %s',
                      mandatory=False,
                      default = "mutualinfo")
    vol_name = traits.Str(desc="vol_name",
                      argstr='--vol_name %s',
                      mandatory=False,
                      default = "T1")


class SetOrigintoACOutputSpec(TraitedSpec):
    output_file = DockerFile(desc = "volume processed")


class SetOrigintoAC(DockerInterface):
    input_spec = SetOrigintoACInputSpec
    output_spec = SetOrigintoACOutputSpec
    container_cmd = "python app/SetOrigintoACbet.py"
    docker_image = "set_origin_to_ac"

    def _list_outputs(self):
        outputs = self.output_spec().get()
        inputs = self.inputs.get()
        outputs['output_file'] = os.path.join(os.getcwd(), "T1/T1_oc.nii")
        return outputs
