Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 14, 2024
1 parent 3d4e352 commit b5087ec
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 70 deletions.
5 changes: 3 additions & 2 deletions nobrainer/ext/SynthSeg/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
# python imports
import os

# third-party imports
from nobrainer.ext.lab2im import edit_volumes, utils
import numpy as np
from scipy.ndimage.morphology import distance_transform_edt
from scipy.stats import wilcoxon

# third-party imports
from nobrainer.ext.lab2im import edit_volumes, utils


def fast_dice(x, y, labels):
"""Fast implementation of Dice scores.
Expand Down
5 changes: 3 additions & 2 deletions nobrainer/ext/SynthSeg/metrics_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
License.
"""

# third-party imports
from nobrainer.ext.lab2im import layers
import keras.layers as KL
from keras.models import Model

# python imports
import numpy as np
import tensorflow as tf

# third-party imports
from nobrainer.ext.lab2im import layers


def metrics_model(input_model, label_list, metrics="dice"):

Expand Down
11 changes: 6 additions & 5 deletions nobrainer/ext/SynthSeg/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
# python imports
import os

import keras.backend as K
import keras.layers as KL
from keras.models import Model
import numpy as np
import tensorflow as tf

# project imports
from nobrainer.ext.SynthSeg import evaluate

# third-party imports
from nobrainer.ext.lab2im import edit_volumes, layers, utils
from nobrainer.ext.neuron import models as nrn_models
import keras.backend as K
import keras.layers as KL
from keras.models import Model
import numpy as np
import tensorflow as tf


def predict(
Expand Down
9 changes: 5 additions & 4 deletions nobrainer/ext/SynthSeg/predict_denoiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
# python imports
import os

import keras.layers as KL
from keras.models import Model
import numpy as np
import tensorflow as tf

# project imports
from nobrainer.ext.SynthSeg import evaluate
from nobrainer.ext.SynthSeg.predict import postprocess, write_csv

# third-party imports
from nobrainer.ext.lab2im import edit_volumes, layers, utils
from nobrainer.ext.neuron import models as nrn_models
import keras.layers as KL
from keras.models import Model
import numpy as np
import tensorflow as tf


def predict(
Expand Down
9 changes: 5 additions & 4 deletions nobrainer/ext/SynthSeg/predict_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
# python imports
import os

import keras.layers as KL
from keras.models import Model
import numpy as np
import tensorflow as tf

# project imports
from nobrainer.ext.SynthSeg import evaluate
from nobrainer.ext.SynthSeg.predict import write_csv

# third-party imports
from nobrainer.ext.lab2im import edit_volumes, layers, utils
from nobrainer.ext.neuron import models as nrn_models
import keras.layers as KL
from keras.models import Model
import numpy as np
import tensorflow as tf


def predict(
Expand Down
9 changes: 5 additions & 4 deletions nobrainer/ext/SynthSeg/predict_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@
# python imports
import os

import keras.layers as KL
from keras.models import Model
import numpy as np
import tensorflow as tf

# project imports
from nobrainer.ext.SynthSeg import evaluate

# third-party imports
from nobrainer.ext.lab2im import edit_volumes, utils
from nobrainer.ext.neuron import models as nrn_models
import keras.layers as KL
from keras.models import Model
import numpy as np
import tensorflow as tf


def predict(
Expand Down
11 changes: 6 additions & 5 deletions nobrainer/ext/SynthSeg/predict_synthseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
import sys
import traceback

import keras.backend as K
import keras.layers as KL
from keras.models import Model
import numpy as np
import tensorflow as tf

# project imports
from nobrainer.ext.SynthSeg import evaluate
from nobrainer.ext.SynthSeg.predict import get_flip_indices, write_csv

# third-party imports
from nobrainer.ext.lab2im import edit_volumes, layers, utils
from nobrainer.ext.neuron import models as nrn_models
import keras.backend as K
import keras.layers as KL
from keras.models import Model
import numpy as np
import tensorflow as tf


def predict(
Expand Down
9 changes: 5 additions & 4 deletions nobrainer/ext/SynthSeg/sample_segmentation_pairs_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@
# python imports
import os

from keras import models
import keras.layers as KL
import numpy as np
import tensorflow as tf

# third-party imports
from nobrainer.ext.lab2im import edit_tensors as l2i_et
from nobrainer.ext.lab2im import edit_volumes
from nobrainer.ext.lab2im import layers as layers
from nobrainer.ext.lab2im import utils
from nobrainer.ext.neuron import models as nrn_models
from keras import models
import keras.layers as KL
import numpy as np
import tensorflow as tf


def sample_segmentation_pairs(
Expand Down
15 changes: 8 additions & 7 deletions nobrainer/ext/SynthSeg/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,21 @@
# python imports
import os

import keras
from keras import models
import keras.callbacks as KC
from keras.optimizers import Adam
import numpy as np
import tensorflow as tf

# project imports
from nobrainer.ext.SynthSeg import metrics_model as metrics
from nobrainer.processing.brain_generator import BrainGenerator

# third-party imports
from nobrainer.ext.lab2im import layers, utils
from nobrainer.ext.neuron import layers as nrn_layers
from nobrainer.ext.neuron import models as nrn_models
import keras
from keras import models
import keras.callbacks as KC
from keras.optimizers import Adam
import numpy as np
import tensorflow as tf
from nobrainer.processing.brain_generator import BrainGenerator


def training(
Expand Down
11 changes: 6 additions & 5 deletions nobrainer/ext/SynthSeg/training_denoiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@
# python imports
import os

from keras import layers as KL
from keras import models
import numpy as np
import tensorflow as tf

# project imports
from nobrainer.ext.SynthSeg import metrics_model as metrics
from nobrainer.models.labels_to_image_model import get_shapes
from nobrainer.ext.SynthSeg.training import train_model
from nobrainer.ext.SynthSeg.training_supervised import build_model_inputs

# third-party imports
from nobrainer.ext.lab2im import layers, utils
from nobrainer.ext.neuron import models as nrn_models
from keras import layers as KL
from keras import models
import numpy as np
import tensorflow as tf
from nobrainer.models.labels_to_image_model import get_shapes


def training(
Expand Down
13 changes: 7 additions & 6 deletions nobrainer/ext/SynthSeg/training_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@
# python imports
import os

from keras import models
import keras.layers as KL
import numpy as np
import tensorflow as tf

# project imports
from nobrainer.ext.SynthSeg import metrics_model as metrics
from nobrainer.processing.brain_generator import BrainGenerator
from nobrainer.models.labels_to_image_model import get_shapes
from nobrainer.ext.SynthSeg.training import train_model

# third-party imports
from nobrainer.ext.lab2im import edit_tensors as l2i_et
from nobrainer.ext.lab2im import layers, utils
from nobrainer.ext.lab2im.edit_volumes import get_ras_axes
from nobrainer.ext.neuron import models as nrn_models
from keras import models
import keras.layers as KL
import numpy as np
import tensorflow as tf
from nobrainer.models.labels_to_image_model import get_shapes
from nobrainer.processing.brain_generator import BrainGenerator


def training(
Expand Down
17 changes: 9 additions & 8 deletions nobrainer/ext/SynthSeg/training_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
# python imports
import os

import keras
from keras import models
import keras.backend as K
import keras.callbacks as KC
import keras.layers as KL
from keras.optimizers import Adam
import numpy as np
import tensorflow as tf

# project imports
from nobrainer.ext.SynthSeg import metrics_model as metrics

Expand All @@ -31,14 +40,6 @@
from nobrainer.ext.neuron import layers as nrn_layers
from nobrainer.ext.neuron import models as nrn_models
from nobrainer.ext.neuron import utils as nrn_utils
import keras
from keras import models
import keras.backend as K
import keras.callbacks as KC
import keras.layers as KL
from keras.optimizers import Adam
import numpy as np
import tensorflow as tf


def training(
Expand Down
13 changes: 7 additions & 6 deletions nobrainer/ext/SynthSeg/training_supervised.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@
# python imports
import os

from keras import models
import keras.layers as KL
import numpy as np
import numpy.random as npr
import tensorflow as tf

# project imports
from nobrainer.ext.SynthSeg import metrics_model as metrics
from nobrainer.models.labels_to_image_model import get_shapes
from nobrainer.ext.SynthSeg.training import train_model

# third-party imports
from nobrainer.ext.lab2im import edit_tensors as l2i_et
from nobrainer.ext.lab2im import layers, utils
from nobrainer.ext.lab2im.edit_volumes import get_ras_axes
from nobrainer.ext.neuron import models as nrn_models
from keras import models
import keras.layers as KL
import numpy as np
import numpy.random as npr
import tensorflow as tf
from nobrainer.models.labels_to_image_model import get_shapes


def training(
Expand Down
7 changes: 4 additions & 3 deletions nobrainer/ext/SynthSeg/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
import os
import re

import matplotlib.pyplot as plt
import numpy as np
from tensorflow.python.summary.summary_iterator import summary_iterator

# project imports
from nobrainer.ext.SynthSeg.predict import predict

# third-party imports
from nobrainer.ext.lab2im import utils
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.python.summary.summary_iterator import summary_iterator


def validate_training(
Expand Down
7 changes: 4 additions & 3 deletions nobrainer/ext/SynthSeg/validate_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
import os
import re

import matplotlib.pyplot as plt
import numpy as np
from tensorflow.python.summary.summary_iterator import summary_iterator

# project imports
from nobrainer.ext.SynthSeg.predict_qc import predict

# third-party imports
from nobrainer.ext.lab2im import utils
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.python.summary.summary_iterator import summary_iterator


def validate_training(
Expand Down
3 changes: 1 addition & 2 deletions nobrainer/processing/brain_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
# python imports
import numpy as np

from nobrainer.models.labels_to_image_model import labels_to_image_model

# project imports
from nobrainer.ext.SynthSeg.model_inputs import build_model_inputs

# third-party imports
from nobrainer.ext.lab2im import edit_volumes, utils
from nobrainer.models.labels_to_image_model import labels_to_image_model


class BrainGenerator:
Expand Down

0 comments on commit b5087ec

Please sign in to comment.