Skip to content

Commit

Permalink
Some minor corrections (#265)
Browse files Browse the repository at this point in the history
* keep_gcc_bin_mask

* IsoSurface gcc

* crop_T1 as optionnal before crop_aladin

* relaunching with curl modif

* crop_T1 and crop_aladin for ANTS_T1
  • Loading branch information
davidmeunier79 authored Nov 4, 2024
1 parent 09fc4bd commit 15b09de
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 227 deletions.
63 changes: 17 additions & 46 deletions macapype/nodes/pad.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,57 +16,28 @@ def pad_back(seg_pipe, data_preparation_pipe, inputnode,
pad_nodename = "pad_" + outputnodefile

if "short_preparation_pipe" in params.keys():
if "crop_T1" in params["short_preparation_pipe"].keys():

print("Padding mask in native space")
pad_node = pe.Node(
niu.Function(
input_names=[
'cropped_img_file',
'orig_img_file',
'indiv_crop'],
output_names=['padded_img_file'],
function=padding_cropped_img),
name=pad_nodename)

seg_pipe.connect(
node, nodefile,
pad_node, "cropped_img_file")

seg_pipe.connect(
data_preparation_pipe, "outputnode.native_T1",
pad_node, "orig_img_file")
print("Using reg_aladin transfo to pad mask back")
pad_node = pe.Node(
RegResample(inter_val="NN"),
name=pad_nodename)

seg_pipe.connect(
inputnode, "indiv_params",
pad_node, "indiv_crop")

seg_pipe.connect(
pad_node, "padded_img_file",
outputnode, outputnodefile)

else:
print("Using reg_aladin transfo to pad mask back")
pad_node = pe.Node(
RegResample(inter_val="NN"),
name=pad_nodename)
seg_pipe.connect(
node, nodefile,
pad_node, "flo_file")

seg_pipe.connect(
node, nodefile,
pad_node, "flo_file")
seg_pipe.connect(
data_preparation_pipe, "outputnode.native_T1",
pad_node, "ref_file")

seg_pipe.connect(
data_preparation_pipe, "outputnode.native_T1",
pad_node, "ref_file")
seg_pipe.connect(
data_preparation_pipe, "inv_tranfo.out_file",
pad_node, "trans_file")

seg_pipe.connect(
data_preparation_pipe, "inv_tranfo.out_file",
pad_node, "trans_file")

# outputnode
seg_pipe.connect(
pad_node, "out_file",
outputnode, outputnodefile)
# outputnode
seg_pipe.connect(
pad_node, "out_file",
outputnode, outputnodefile)

elif "long_single_preparation_pipe" in params.keys():
if "prep_T1" in params["long_single_preparation_pipe"].keys():
Expand Down
11 changes: 3 additions & 8 deletions macapype/nodes/surface.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from nipype.interfaces.base import TraitedSpec, SimpleInterface
from nipype.interfaces.base import traits, File
from nipype.interfaces.base import (TraitedSpec, SimpleInterface, traits, File)


def keep_gcc(nii_file):

import os
import nibabel as nib
import numpy as np

from nipype.utils.filemanip import split_filename as split_f

def getLargestCC(segmentation):
Expand All @@ -28,8 +25,6 @@ def getLargestCC(segmentation):
data[data > 0] = 1
binary = np.array(data, dtype="bool")

# skimage

# skimage GCC
new_data = getLargestCC(binary)

Expand Down Expand Up @@ -135,8 +130,8 @@ def wrap_afni_IsoSurface(nii_file):
remesh = 0.5

# Tsmooth
KPB = 0.1
NITER = 100
KPB = 0.0001
NITER = 10000

# remesh
remesh = 0.5
Expand Down
Loading

0 comments on commit 15b09de

Please sign in to comment.