Ejemplo n.º 1
0
    def _make_random_transforms_cmd(self,
                                    in_path,
                                    out_path,
                                    count,
                                    param=None):
        if param is None:
            param = self.get_random_transforms_param_defaults()

        st.check_exists(in_path, "Input")

        dim_str = " -dim %d" % (self.dim)
        count_str = " -count %d" % (count)
        cmd = self.bin_path + "ACRandomTransforms" + exe_extension
        cmd = cmd + " -in " + in_path + " -out " + out_path + dim_str + count_str + st.param_dict_to_string(
            param)
        return cmd
def make_transform(index, atlas_id, params):
    # atlas image
    #label_atlas_str = atlas_path + "MI" + atlas_id + "labels.nii.gz"#ind_str("S", index, ".labels.nii.gz")
    mask_atlas_str = atlas_path + "MI" + atlas_id + "mask.nii.gz"
    #mri_atlas_str = atlas_path + "MI" + atlas_id + "template.nii.gz"

    # ref image
    #label_ref_str = labels_path + ind_str("S", index, ".labels.nii.gz")
    mask_ref_str = masks_path + ind_str("S", index, ".brainmask.nii.gz")
    #mri_ref_str = mri_path + ind_str("S", index, ".nii.gz")

    out = out_path + ind_str("S", index, "/")
    out_image = out + "mask.nii.gz"
    transform_path = out + "transform_complete.txt"
    overlap_out = out_path + ind_str("S", index,
                                     "/") + "brain_mask_overlap.csv"
    #" -mask1 " + mask_ref_str + " -mask2 " + mask_atlas_str +

    return exe_path + " -ref " + mask_ref_str + " -in " + mask_atlas_str + " -out " + out_image + " -label_overlap_out " + overlap_out + " -transform " + transform_path + st.param_dict_to_string(
        params)
Ejemplo n.º 3
0
    def _make_register_cmd(self,
                           ref_im_path,
                           flo_im_path,
                           out_path,
                           is_rigid,
                           param=None):
        if param is None:
            print("Using default param.")
            param = self.get_register_param_defaults()

        st.check_exists(ref_im_path, "Reference")
        st.check_exists(ref_im_path, "Floating")

        if self.dim == 2:
            three_d_str = " -3d 0"
        else:
            three_d_str = " -3d 1"
        if is_rigid:
            rigid_str = " -rigid 1"
        else:
            rigid_str = " -rigid 0"
        cmd = self.bin_path + "ACRegister" + exe_extension
        st.check_exists(cmd, "Executable")
        cmd = cmd + " -in1 " + ref_im_path + " -in2 " + flo_im_path + " -out " + out_path + rigid_str + three_d_str + st.param_dict_to_string(
            param)
        return cmd
Ejemplo n.º 4
0
    def _make_label_overlap_cmd(self,
                                ref_im_path,
                                transformed_im_path,
                                out_path,
                                param=None):
        if param is None:
            param = self.get_label_overlap_param_defaults()

        st.check_exists(ref_im_path, "Reference")
        st.check_exists(transformed_im_path, "Transformed")

        dim_str = " -dim %d" % (self.dim)
        cmd = self.bin_path + "ACLabelOverlap" + exe_extension
        st.check_exists(cmd, "Executable")
        cmd = cmd + " -in1 " + ref_im_path + " -in2 " + transformed_im_path + " -out " + out_path + dim_str + st.param_dict_to_string(
            param)
        return cmd
Ejemplo n.º 5
0
    def _make_transform_cmd(self,
                            ref_im_path,
                            flo_im_path,
                            out_path,
                            transform_path,
                            param=None):
        if param is None:
            param = self.get_transform_param_defaults()

        st.check_exists(ref_im_path, "Reference")
        st.check_exists(flo_im_path, "Floating")

        dim_str = " -dim %d" % (self.dim)
        cmd = self.bin_path + "ACTransform" + exe_extension
        st.check_exists(cmd, "Executable")
        cmd = cmd + " -ref " + ref_im_path + " -in " + flo_im_path + " -out " + out_path + " -transform " + transform_path + dim_str + st.param_dict_to_string(
            param)
        return cmd