SYMBOL INDEX (1108 symbols across 122 files) FILE: conftest.py function pytest_collection_modifyitems (line 9) | def pytest_collection_modifyitems(config, items): FILE: nobrainer/_version.py function get_keywords (line 20) | def get_keywords(): class VersioneerConfig (line 33) | class VersioneerConfig: function get_config (line 37) | def get_config(): class NotThisMethod (line 51) | class NotThisMethod(Exception): function register_vcs_handler (line 59) | def register_vcs_handler(vcs, method): # decorator function run_command (line 72) | def run_command(commands, args, cwd=None, verbose=False, hide_stderr=Fal... function versions_from_parentdir (line 109) | def versions_from_parentdir(parentdir_prefix, root, verbose): function git_get_keywords (line 140) | def git_get_keywords(versionfile_abs): function git_versions_from_keywords (line 168) | def git_versions_from_keywords(keywords, tag_prefix, verbose): function git_pieces_from_vcs (line 239) | def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): function plus_or_dot (line 374) | def plus_or_dot(pieces): function render_pep440 (line 381) | def render_pep440(pieces): function render_pep440_branch (line 405) | def render_pep440_branch(pieces): function pep440_split_post (line 434) | def pep440_split_post(ver): function render_pep440_pre (line 444) | def render_pep440_pre(pieces): function render_pep440_post (line 468) | def render_pep440_post(pieces): function render_pep440_post_branch (line 495) | def render_pep440_post_branch(pieces): function render_pep440_old (line 524) | def render_pep440_old(pieces): function render_git_describe (line 546) | def render_git_describe(pieces): function render_git_describe_long (line 566) | def render_git_describe_long(pieces): function render (line 586) | def render(pieces, style): function get_versions (line 628) | def get_versions(): FILE: nobrainer/augmentation/profiles.py function get_augmentation_profile (line 21) | def get_augmentation_profile( FILE: nobrainer/augmentation/synthseg.py class SynthSegGenerator (line 23) | class SynthSegGenerator(torch.utils.data.Dataset): method __init__ (line 61) | def __init__( method __len__ (line 106) | def __len__(self) -> int: method _get_rng (line 109) | def _get_rng(self, idx: int) -> np.random.Generator: method __getitem__ (line 115) | def __getitem__(self, idx: int) -> dict[str, torch.Tensor]: method _generate_intensities (line 153) | def _generate_intensities(self, label_data: np.ndarray) -> np.ndarray: method _spatial_augmentation (line 191) | def _spatial_augmentation( method _remap_lr_labels (line 266) | def _remap_lr_labels(label: np.ndarray) -> np.ndarray: method _randomize_resolution (line 282) | def _randomize_resolution(self, image: np.ndarray) -> np.ndarray: method _add_bias_field (line 307) | def _add_bias_field(self, image: np.ndarray) -> np.ndarray: function _rot_x (line 338) | def _rot_x(angle: float) -> np.ndarray: function _rot_y (line 343) | def _rot_y(angle: float) -> np.ndarray: function _rot_z (line 348) | def _rot_z(angle: float) -> np.ndarray: FILE: nobrainer/augmentation/transforms.py class Augmentation (line 33) | class Augmentation: method __init__ (line 47) | def __init__(self, transform: Any) -> None: method __call__ (line 50) | def __call__(self, data: Any) -> Any: method __repr__ (line 53) | def __repr__(self) -> str: class TrainableCompose (line 57) | class TrainableCompose(Compose): method __init__ (line 73) | def __init__(self, transforms: list, mode: str = "train") -> None: method mode (line 78) | def mode(self) -> str: method mode (line 82) | def mode(self, value: str) -> None: method __call__ (line 87) | def __call__(self, data: Any, mode: str | None = None, **kwargs) -> Any: FILE: nobrainer/cli/main.py class JSONParamType (line 22) | class JSONParamType(click.ParamType): method convert (line 25) | def convert(self, value, param, ctx): function cli (line 36) | def cli(): function predict (line 107) | def predict( function convert_tfrecords (line 227) | def convert_tfrecords(*, input_paths, output_dir, output_format, verbose): function convert_to_zarr (line 274) | def convert_to_zarr(*, output, images, labels, chunk_shape, no_conform, ... function merge (line 302) | def merge(): function generate (line 348) | def generate( function research (line 457) | def research( function commit (line 546) | def commit( function save (line 584) | def save(): function evaluate (line 591) | def evaluate(): function info (line 598) | def info(): FILE: nobrainer/cli/tests/main_test.py function test_convert_nonscalar_labels (line 18) | def test_convert_nonscalar_labels(tmp_path): function test_convert_scalar_int_labels (line 40) | def test_convert_scalar_int_labels(tmp_path): function test_convert_scalar_float_labels (line 68) | def test_convert_scalar_float_labels(tmp_path): function test_convert_multi_resolution (line 96) | def test_convert_multi_resolution(tmp_path): function test_merge (line 128) | def test_merge(): function test_predict (line 132) | def test_predict(): function test_generate (line 156) | def test_generate(): function test_save (line 190) | def test_save(): function test_evaluate (line 195) | def test_evaluate(): function test_info (line 199) | def test_info(): FILE: nobrainer/dataset.py function get_dataset (line 20) | def get_dataset( class ZarrDataset (line 163) | class ZarrDataset(torch.utils.data.Dataset): method __init__ (line 170) | def __init__( method __len__ (line 180) | def __len__(self) -> int: method __getitem__ (line 183) | def __getitem__(self, idx: int) -> dict: function _is_zarr_path (line 208) | def _is_zarr_path(path: str | Path) -> bool: function _get_zarr_dataset (line 213) | def _get_zarr_dataset( FILE: nobrainer/datasets/__init__.py function _check_datalad (line 15) | def _check_datalad(): FILE: nobrainer/datasets/openneuro.py function _dl (line 50) | def _dl(): function install_dataset (line 62) | def install_dataset( function install_derivatives (line 93) | def install_derivatives( function glob_dataset (line 132) | def glob_dataset( function fetch_files (line 156) | def fetch_files( function _extract_subject_id (line 190) | def _extract_subject_id(path: Path) -> str: function _file_ok (line 207) | def _file_ok(p: Path) -> bool: function find_subject_pairs (line 215) | def find_subject_pairs( function write_manifest (line 325) | def write_manifest( FILE: nobrainer/datasets/zarr_store.py function _conform_volume (line 24) | def _conform_volume(img, target_shape, target_voxel_size=(1.0, 1.0, 1.0)): function _infer_target_shape (line 31) | def _infer_target_shape( function create_zarr_store (line 63) | def create_zarr_store( function store_info (line 247) | def store_info(store_path: str | Path) -> dict[str, Any]: function create_partition (line 266) | def create_partition( function load_partition (line 334) | def load_partition(partition_path: str | Path) -> dict[str, list[str]]: FILE: nobrainer/distributed_learning/dwc.py function distributed_weight_consolidation (line 9) | def distributed_weight_consolidation(model_weights, model_priors): FILE: nobrainer/experiment.py class _LocalLogger (line 40) | class _LocalLogger: method __init__ (line 43) | def __init__(self, output_dir: Path) -> None: method log (line 52) | def log(self, metrics: dict[str, Any]) -> None: method log_config (line 68) | def log_config(self, config: dict[str, Any]) -> None: method finish (line 72) | def finish(self) -> None: class _WandbLogger (line 79) | class _WandbLogger: method __init__ (line 82) | def __init__( method log (line 100) | def log(self, metrics: dict[str, Any]) -> None: method log_config (line 103) | def log_config(self, config: dict[str, Any]) -> None: method finish (line 106) | def finish(self) -> None: class ExperimentTracker (line 110) | class ExperimentTracker: method __init__ (line 136) | def __init__( method log (line 177) | def log(self, metrics: dict[str, Any]) -> None: method log_config (line 182) | def log_config(self, config: dict[str, Any]) -> None: method finish (line 187) | def finish(self) -> None: method callback (line 192) | def callback(self, **extra_fields) -> callable: FILE: nobrainer/gpu.py function get_device (line 43) | def get_device() -> torch.device: function gpu_count (line 52) | def gpu_count() -> int: function gpu_info (line 59) | def gpu_info() -> list[dict[str, Any]]: function _estimate_memory_per_sample (line 80) | def _estimate_memory_per_sample( function auto_batch_size (line 148) | def auto_batch_size( function scale_for_multi_gpu (line 223) | def scale_for_multi_gpu( FILE: nobrainer/io.py function read_csv (line 22) | def read_csv( function read_mapping (line 33) | def read_mapping( function _compute_sha256 (line 46) | def _compute_sha256(path: str | Path) -> str: function _parse_tfrecord_file (line 54) | def _parse_tfrecord_file(path: str | Path): function convert_tfrecords (line 71) | def convert_tfrecords( function _keras_conv3d_to_pytorch (line 173) | def _keras_conv3d_to_pytorch(w: np.ndarray) -> np.ndarray: function convert_weights (line 180) | def convert_weights( function _map_name (line 249) | def _map_name( function nifti_to_zarr (line 275) | def nifti_to_zarr( function zarr_to_nifti (line 357) | def zarr_to_nifti( FILE: nobrainer/layers/InstanceNorm.py class InstanceNormalization (line 6) | class InstanceNormalization(GroupNormalization): method __init__ (line 37) | def __init__(self, **kwargs): FILE: nobrainer/layers/bernoulli_dropout.py class BernoulliDropout (line 7) | class BernoulliDropout(nn.Module): method __init__ (line 36) | def __init__( method forward (line 55) | def forward(self, x: torch.Tensor) -> torch.Tensor: method extra_repr (line 66) | def extra_repr(self) -> str: FILE: nobrainer/layers/concrete_dropout.py class ConcreteDropout (line 9) | class ConcreteDropout(nn.Module): method __init__ (line 38) | def __init__( method p_post (line 64) | def p_post(self) -> torch.Tensor: method forward (line 68) | def forward(self, x: torch.Tensor) -> torch.Tensor: method _apply_concrete (line 77) | def _apply_concrete(self, x: torch.Tensor) -> torch.Tensor: method _kl_divergence (line 94) | def _kl_divergence(self) -> torch.Tensor: method extra_repr (line 103) | def extra_repr(self) -> str: FILE: nobrainer/layers/gaussian_dropout.py class GaussianDropout (line 9) | class GaussianDropout(nn.Module): method __init__ (line 34) | def __init__( method forward (line 57) | def forward(self, x: torch.Tensor) -> torch.Tensor: method extra_repr (line 63) | def extra_repr(self) -> str: FILE: nobrainer/layers/maxpool4d.py class MaxPool4D (line 12) | class MaxPool4D(nn.Module): method __init__ (line 33) | def __init__( method forward (line 44) | def forward(self, x: torch.Tensor) -> torch.Tensor: method extra_repr (line 59) | def extra_repr(self) -> str: FILE: nobrainer/layers/padding.py class ZeroPadding3DChannels (line 8) | class ZeroPadding3DChannels(nn.Module): method __init__ (line 20) | def __init__(self, padding: int) -> None: method forward (line 24) | def forward(self, x: torch.Tensor) -> torch.Tensor: method extra_repr (line 28) | def extra_repr(self) -> str: FILE: nobrainer/losses.py function dice (line 13) | def dice( function generalized_dice (line 46) | def generalized_dice( function jaccard (line 63) | def jaccard( function tversky (line 86) | def tversky( function elbo (line 120) | def elbo( function wasserstein (line 154) | def wasserstein(y_true: torch.Tensor, y_pred: torch.Tensor) -> torch.Ten... function gradient_penalty (line 172) | def gradient_penalty( function compute_class_weights (line 219) | def compute_class_weights( function weighted_cross_entropy (line 289) | def weighted_cross_entropy( class HammingLoss (line 308) | class HammingLoss(torch.nn.Module): method __init__ (line 323) | def __init__(self, from_logits: bool = True) -> None: method forward (line 327) | def forward(self, pred: torch.Tensor, target: torch.Tensor) -> torch.T... function hamming (line 347) | def hamming(from_logits: bool = True) -> HammingLoss: class DiceCELoss (line 352) | class DiceCELoss(torch.nn.Module): method __init__ (line 373) | def __init__( method forward (line 389) | def forward(self, pred: torch.Tensor, target: torch.Tensor) -> torch.T... class FocalLoss (line 409) | class FocalLoss(torch.nn.Module): method __init__ (line 423) | def __init__( method forward (line 435) | def forward(self, pred: torch.Tensor, target: torch.Tensor) -> torch.T... function focal (line 453) | def focal(gamma: float = 2.0, alpha: torch.Tensor | None = None) -> Foca... function get (line 477) | def get(name: str): FILE: nobrainer/metrics.py function dice_metric (line 13) | def dice_metric( function generalized_dice_metric (line 34) | def generalized_dice_metric( function jaccard_metric (line 52) | def jaccard_metric( function tversky_metric (line 65) | def tversky_metric( function hausdorff_metric (line 82) | def hausdorff_metric( function hamming_metric (line 112) | def hamming_metric(reduction: str = "mean") -> "HammingMetric": class HammingMetric (line 122) | class HammingMetric: method __init__ (line 125) | def __init__(self, reduction: str = "mean") -> None: method __call__ (line 128) | def __call__( function get (line 158) | def get(name: str): FILE: nobrainer/models/__init__.py function get (line 53) | def get(name: str): function available_models (line 86) | def available_models() -> list[str]: function list_available_models (line 90) | def list_available_models() -> None: FILE: nobrainer/models/_utils.py function unpack_batch (line 12) | def unpack_batch( function load_input (line 54) | def load_input( function model_supports_mc (line 82) | def model_supports_mc(model: torch.nn.Module) -> bool: FILE: nobrainer/models/autoencoder.py class Autoencoder (line 15) | class Autoencoder(nn.Module): method __init__ (line 34) | def __init__( method encode (line 97) | def encode(self, x: torch.Tensor) -> torch.Tensor: method decode (line 101) | def decode(self, z: torch.Tensor) -> torch.Tensor: method forward (line 105) | def forward(self, x: torch.Tensor) -> torch.Tensor: function autoencoder (line 109) | def autoencoder( FILE: nobrainer/models/bayesian/bayesian_meshnet.py class _BayesConvBNActDrop (line 26) | class _BayesConvBNActDrop(PyroModule): method __init__ (line 29) | def __init__( method forward (line 55) | def forward(self, x: torch.Tensor) -> torch.Tensor: class BayesianMeshNet (line 59) | class BayesianMeshNet(PyroModule): method __init__ (line 92) | def __init__( method forward (line 146) | def forward(self, x: torch.Tensor, **kwargs) -> torch.Tensor: function bayesian_meshnet (line 153) | def bayesian_meshnet( FILE: nobrainer/models/bayesian/bayesian_vnet.py class _BayesResBlock (line 24) | class _BayesResBlock(PyroModule): method __init__ (line 27) | def __init__(self, channels: int, prior_type: str = "standard_normal")... method forward (line 38) | def forward(self, x: torch.Tensor) -> torch.Tensor: class _EncoderBlock (line 44) | class _EncoderBlock(PyroModule): method __init__ (line 47) | def __init__( method forward (line 59) | def forward(self, x: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: class _DecoderBlock (line 65) | class _DecoderBlock(PyroModule): method __init__ (line 68) | def __init__( method forward (line 83) | def forward(self, x: torch.Tensor, skip: torch.Tensor) -> torch.Tensor: class BayesianVNet (line 94) | class BayesianVNet(PyroModule): method __init__ (line 118) | def __init__( method forward (line 166) | def forward(self, x: torch.Tensor, **kwargs) -> torch.Tensor: function bayesian_vnet (line 185) | def bayesian_vnet( FILE: nobrainer/models/bayesian/kwyk_meshnet.py class _VWNLayerBernoulli (line 31) | class _VWNLayerBernoulli(nn.Module): method __init__ (line 34) | def __init__( method forward (line 54) | def forward( class _VWNLayerConcrete (line 67) | class _VWNLayerConcrete(nn.Module): method __init__ (line 70) | def __init__( method forward (line 95) | def forward( class KWYKMeshNet (line 107) | class KWYKMeshNet(nn.Module): method __init__ (line 136) | def __init__( method forward (line 181) | def forward( method kl_divergence (line 218) | def kl_divergence(self) -> torch.Tensor: method concrete_regularization (line 226) | def concrete_regularization(self) -> torch.Tensor: function kwyk_meshnet (line 235) | def kwyk_meshnet( FILE: nobrainer/models/bayesian/layers.py function _kl_normal_normal (line 36) | def _kl_normal_normal( function _kl_spike_and_slab (line 50) | def _kl_spike_and_slab( class BayesianConv3d (line 100) | class BayesianConv3d(PyroModule): method __init__ (line 124) | def __init__( method weight_sigma (line 196) | def weight_sigma(self) -> torch.Tensor: method forward (line 199) | def forward(self, x: torch.Tensor) -> torch.Tensor: class BayesianLinear (line 239) | class BayesianLinear(PyroModule): method __init__ (line 258) | def __init__( method weight_sigma (line 312) | def weight_sigma(self) -> torch.Tensor: method forward (line 315) | def forward(self, x: torch.Tensor) -> torch.Tensor: FILE: nobrainer/models/bayesian/utils.py function accumulate_kl (line 11) | def accumulate_kl(model: torch.nn.Module) -> torch.Tensor: FILE: nobrainer/models/bayesian/vwn_layers.py class FFGConv3d (line 34) | class FFGConv3d(nn.Module): method __init__ (line 74) | def __init__( method kernel_m (line 120) | def kernel_m(self) -> torch.Tensor: method weight_sigma (line 126) | def weight_sigma(self) -> torch.Tensor: method forward (line 130) | def forward(self, x: torch.Tensor, mc: bool = True) -> torch.Tensor: class ConcreteDropout3d (line 166) | class ConcreteDropout3d(nn.Module): method __init__ (line 185) | def __init__( method p (line 200) | def p(self) -> torch.Tensor: method forward (line 204) | def forward(self, x: torch.Tensor, mc: bool = True) -> torch.Tensor: method kl_divergence (line 234) | def kl_divergence(self) -> torch.Tensor: method regularization (line 244) | def regularization(self) -> torch.Tensor: FILE: nobrainer/models/bayesian/warmstart.py function warmstart_bayesian_from_deterministic (line 17) | def warmstart_bayesian_from_deterministic( function _transfer_by_name (line 60) | def _transfer_by_name( function _transfer_by_position (line 84) | def _transfer_by_position( function _transfer_pair (line 164) | def _transfer_pair( function warmstart_kwyk_from_deterministic (line 206) | def warmstart_kwyk_from_deterministic( FILE: nobrainer/models/generative/dcgan.py class _GenBlock (line 25) | class _GenBlock(nn.Module): method __init__ (line 28) | def __init__( method forward (line 45) | def forward(self, x: torch.Tensor) -> torch.Tensor: class _DiscBlock (line 49) | class _DiscBlock(nn.Module): method __init__ (line 52) | def __init__( method forward (line 70) | def forward(self, x: torch.Tensor) -> torch.Tensor: class _DCGenerator (line 79) | class _DCGenerator(nn.Module): method __init__ (line 82) | def __init__(self, latent_size: int = 128, n_filters: int = 64) -> None: method forward (line 101) | def forward(self, z: torch.Tensor) -> torch.Tensor: class _DCDiscriminator (line 110) | class _DCDiscriminator(nn.Module): method __init__ (line 113) | def __init__(self, n_filters: int = 64) -> None: method forward (line 130) | def forward(self, img: torch.Tensor) -> torch.Tensor: class DCGAN (line 139) | class DCGAN(pl.LightningModule): method __init__ (line 157) | def __init__( method _sample_z (line 177) | def _sample_z(self, n: int) -> torch.Tensor: method training_step (line 180) | def training_step(self, batch: Any, batch_idx: int) -> None: method configure_optimizers (line 234) | def configure_optimizers(self): function dcgan (line 244) | def dcgan( FILE: nobrainer/models/generative/progressivegan.py function _pixel_norm (line 27) | def _pixel_norm(x: torch.Tensor, eps: float = 1e-8) -> torch.Tensor: class _ConvBlock (line 32) | class _ConvBlock(nn.Module): method __init__ (line 33) | def __init__(self, in_ch: int, out_ch: int, use_pixel_norm: bool = Tru... method forward (line 38) | def forward(self, x: torch.Tensor) -> torch.Tensor: class _ToRGB (line 45) | class _ToRGB(nn.Module): method __init__ (line 46) | def __init__(self, in_ch: int) -> None: method forward (line 50) | def forward(self, x: torch.Tensor) -> torch.Tensor: class _FromRGB (line 54) | class _FromRGB(nn.Module): method __init__ (line 55) | def __init__(self, out_ch: int) -> None: method forward (line 59) | def forward(self, x: torch.Tensor) -> torch.Tensor: class _Generator (line 68) | class _Generator(nn.Module): method __init__ (line 71) | def __init__( method forward (line 104) | def forward(self, z: torch.Tensor) -> torch.Tensor: class _Discriminator (line 134) | class _Discriminator(nn.Module): method __init__ (line 137) | def __init__( method forward (line 170) | def forward(self, img: torch.Tensor) -> torch.Tensor: class ProgressiveGAN (line 197) | class ProgressiveGAN(pl.LightningModule): method __init__ (line 220) | def __init__( method _gradient_penalty (line 253) | def _gradient_penalty(self, real: torch.Tensor, fake: torch.Tensor) ->... method _sample_z (line 269) | def _sample_z(self, n: int) -> torch.Tensor: method training_step (line 276) | def training_step(self, batch: Any, batch_idx: int) -> None: method on_train_batch_end (line 303) | def on_train_batch_end(self, *args: Any, **kwargs: Any) -> None: method configure_optimizers (line 314) | def configure_optimizers(self): function progressivegan (line 324) | def progressivegan( FILE: nobrainer/models/highresnet.py class _ResBlock (line 17) | class _ResBlock(nn.Module): method __init__ (line 20) | def __init__( method forward (line 41) | def forward(self, x: torch.Tensor) -> torch.Tensor: class _ZeroPadChannels (line 45) | class _ZeroPadChannels(nn.Module): method __init__ (line 48) | def __init__(self, extra_channels: int) -> None: method forward (line 52) | def forward(self, x: torch.Tensor) -> torch.Tensor: class HighResNet (line 56) | class HighResNet(nn.Module): method __init__ (line 79) | def __init__( method forward (line 120) | def forward(self, x: torch.Tensor) -> torch.Tensor: function highresnet (line 137) | def highresnet( FILE: nobrainer/models/meshnet.py class _ConvBNActDrop (line 20) | class _ConvBNActDrop(nn.Module): method __init__ (line 21) | def __init__( method forward (line 45) | def forward(self, x: torch.Tensor) -> torch.Tensor: class MeshNet (line 49) | class MeshNet(nn.Module): method __init__ (line 71) | def __init__( method forward (line 97) | def forward(self, x: torch.Tensor) -> torch.Tensor: function meshnet (line 101) | def meshnet( FILE: nobrainer/models/segformer3d.py class PatchEmbedding3d (line 23) | class PatchEmbedding3d(nn.Module): method __init__ (line 40) | def __init__( method forward (line 58) | def forward(self, x: torch.Tensor) -> tuple[torch.Tensor, int, int, int]: class EfficientSelfAttention3d (line 67) | class EfficientSelfAttention3d(nn.Module): method __init__ (line 74) | def __init__( method forward (line 100) | def forward( class DWConv3d (line 132) | class DWConv3d(nn.Module): method __init__ (line 135) | def __init__(self, dim: int = 64) -> None: method forward (line 140) | def forward(self, x: torch.Tensor, D: int, H: int, W: int) -> torch.Te... class MixFFN3d (line 147) | class MixFFN3d(nn.Module): method __init__ (line 150) | def __init__( method forward (line 161) | def forward(self, x: torch.Tensor, D: int, H: int, W: int) -> torch.Te... class TransformerBlock3d (line 171) | class TransformerBlock3d(nn.Module): method __init__ (line 174) | def __init__( method forward (line 193) | def forward(self, x: torch.Tensor, D: int, H: int, W: int) -> torch.Te... class MixTransformerEncoder3d (line 204) | class MixTransformerEncoder3d(nn.Module): method __init__ (line 211) | def __init__( method forward (line 254) | def forward(self, x: torch.Tensor) -> list[torch.Tensor]: class SegFormerDecoderHead (line 279) | class SegFormerDecoderHead(nn.Module): method __init__ (line 286) | def __init__( method forward (line 307) | def forward(self, features: list[torch.Tensor]) -> torch.Tensor: class SegFormer3D (line 341) | class SegFormer3D(nn.Module): method __init__ (line 369) | def __init__( method forward (line 400) | def forward(self, x: torch.Tensor) -> torch.Tensor: function segformer3d (line 420) | def segformer3d( FILE: nobrainer/models/segmentation.py function unet (line 13) | def unet( function vnet (line 59) | def vnet( function attention_unet (line 89) | def attention_unet( function unetr (line 123) | def unetr( function swin_unetr (line 172) | def swin_unetr( function segresnet (line 216) | def segresnet( FILE: nobrainer/models/simsiam.py class SimSiam (line 17) | class SimSiam(nn.Module): method __init__ (line 50) | def __init__( method _encode (line 83) | def _encode(self, x: torch.Tensor) -> torch.Tensor: method forward (line 95) | def forward( method loss (line 119) | def loss( function simsiam (line 134) | def simsiam( FILE: nobrainer/prediction.py function _forward (line 16) | def _forward(model: nn.Module, tensor: torch.Tensor, mc: bool | None = N... function _pad_to_multiple (line 25) | def _pad_to_multiple( function _extract_blocks (line 36) | def _extract_blocks(arr: np.ndarray, block_shape: tuple[int, int, int]) ... function _stitch_blocks (line 48) | def _stitch_blocks( function strided_patch_positions (line 82) | def strided_patch_positions( function reassemble_predictions (line 135) | def reassemble_predictions( function _predict_strided (line 181) | def _predict_strided( function predict (line 233) | def predict( function predict_with_uncertainty (line 367) | def predict_with_uncertainty( FILE: nobrainer/processing/base.py class BaseEstimator (line 13) | class BaseEstimator: method __init__ (line 25) | def __init__( method model (line 34) | def model(self) -> nn.Module: method save (line 39) | def save(self, save_dir: str | Path) -> None: method load (line 49) | def load(cls, model_dir: str | Path, multi_gpu: bool = True) -> "BaseE... method _build_model (line 69) | def _build_model(self) -> nn.Module: method _restore_from_provenance (line 73) | def _restore_from_provenance(self, prov: dict) -> None: FILE: nobrainer/processing/croissant.py function _sha256 (line 12) | def _sha256(path: str | Path) -> str: function _dataset_checksums (line 21) | def _dataset_checksums(dataset: Any) -> list[dict]: function write_model_croissant (line 33) | def write_model_croissant( function write_checkpoint_croissant (line 106) | def write_checkpoint_croissant( function write_dataset_croissant (line 169) | def write_dataset_croissant( function validate_croissant (line 206) | def validate_croissant(path: str | Path) -> bool: FILE: nobrainer/processing/dataset.py function _load_label_mapping (line 24) | def _load_label_mapping(name_or_path: str) -> Callable: class _LabelRemap (line 72) | class _LabelRemap: method __init__ (line 75) | def __init__(self, lookup: dict[int, int]): method __call__ (line 78) | def __call__(self, x): class Dataset (line 85) | class Dataset: method __init__ (line 100) | def __init__( method from_files (line 121) | def from_files( method from_zarr (line 164) | def from_zarr( method batch (line 230) | def batch(self, batch_size: int) -> "Dataset": method binarize (line 236) | def binarize(self, labels: str | set[int] | Callable | None = None) ->... method shuffle (line 279) | def shuffle(self, buffer_size: int = 100) -> "Dataset": method augment (line 285) | def augment(self, profile: str | bool = True) -> "Dataset": method mix (line 306) | def mix( method streaming (line 343) | def streaming(self, patches_per_volume: int = 10) -> "Dataset": method normalize (line 371) | def normalize(self, fn: Callable | None = None) -> "Dataset": method split (line 377) | def split(self, eval_size: float = 0.1) -> tuple["Dataset", "Dataset"]: method dataloader (line 396) | def dataloader(self) -> DataLoader: method batch_size (line 474) | def batch_size(self) -> int: method block_shape (line 478) | def block_shape(self) -> tuple | None: method to_croissant (line 481) | def to_croissant(self, output_path: str | Path) -> Path: function extract_patches (line 488) | def extract_patches( class PatchDataset (line 570) | class PatchDataset(torch.utils.data.Dataset): method __init__ (line 611) | def __init__( method __len__ (line 640) | def __len__(self) -> int: method __getitem__ (line 643) | def __getitem__(self, idx: int) -> dict[str, torch.Tensor]: method _apply_binarize (line 672) | def _apply_binarize(self, lbl: np.ndarray) -> np.ndarray: method _parse_zarr_path (line 689) | def _parse_zarr_path(path: str) -> tuple[str, str, int] | None: method _get_shape (line 706) | def _get_shape(path: str) -> tuple[int, ...]: method _get_zarr_store (line 727) | def _get_zarr_store(self, store_path: str): method _read_region_cached (line 735) | def _read_region_cached(self, path: str, slc: tuple[slice, ...]) -> np... method _read_region (line 747) | def _read_region(path: str, slc: tuple[slice, ...]) -> np.ndarray: class MixedDataset (line 770) | class MixedDataset(torch.utils.data.Dataset): method __init__ (line 786) | def __init__( method __len__ (line 799) | def __len__(self) -> int: method __getitem__ (line 802) | def __getitem__(self, idx: int) -> dict: FILE: nobrainer/processing/generation.py class Generation (line 16) | class Generation(BaseEstimator): method __init__ (line 27) | def __init__( method fit (line 38) | def fit( method generate (line 78) | def generate( method save (line 102) | def save(self, save_dir: str | Path) -> None: method _build_model (line 111) | def _build_model(self) -> nn.Module: method _restore_from_provenance (line 116) | def _restore_from_provenance(self, prov: dict) -> None: FILE: nobrainer/processing/segmentation.py class Segmentation (line 18) | class Segmentation(BaseEstimator): method __init__ (line 36) | def __init__( method fit (line 53) | def fit( method predict (line 163) | def predict( method evaluate (line 196) | def evaluate( method _build_model (line 226) | def _build_model(self) -> nn.Module: method _restore_from_provenance (line 233) | def _restore_from_provenance(self, prov: dict) -> None: FILE: nobrainer/research/loop.py class ExperimentResult (line 35) | class ExperimentResult: function run_loop (line 47) | def run_loop( function _propose_config (line 181) | def _propose_config( function _propose_via_llm (line 199) | def _propose_via_llm( function _propose_random (line 237) | def _propose_random(current: dict[str, Any]) -> dict[str, Any]: function _parse_config_comment (line 249) | def _parse_config_comment(path: Path) -> dict[str, Any]: function _patch_config (line 261) | def _patch_config(path: Path, config: dict[str, Any]) -> None: function _read_val_dice (line 277) | def _read_val_dice(path: Path) -> float | None: function _has_nan (line 288) | def _has_nan(text: str) -> bool: function _classify_failure (line 292) | def _classify_failure(stderr: str) -> str: function _write_summary (line 301) | def _write_summary( function commit_best_model (line 332) | def commit_best_model( FILE: nobrainer/research/templates/prepare.py function prepare (line 47) | def prepare(*, data_dir: str, val_fraction: float, seed: int, output: st... FILE: nobrainer/research/templates/train_bayesian_vnet.py function main (line 31) | def main() -> None: FILE: nobrainer/slurm.py class SlurmPreemptionHandler (line 39) | class SlurmPreemptionHandler: method __init__ (line 56) | def __init__(self, sig: signal.Signals = signal.SIGUSR1) -> None: method _handle (line 66) | def _handle(self, signum: int, frame: Any) -> None: method is_slurm_job (line 73) | def is_slurm_job() -> bool: method slurm_info (line 78) | def slurm_info() -> dict[str, str]: function save_checkpoint (line 92) | def save_checkpoint( function load_checkpoint (line 148) | def load_checkpoint( FILE: nobrainer/sr-tests/conftest.py function sample_data (line 10) | def sample_data(): function train_eval_split (line 17) | def train_eval_split(sample_data): FILE: nobrainer/sr-tests/test_bayesian_uncertainty.py class TestBayesianUncertainty (line 19) | class TestBayesianUncertainty: method test_bayesian_predict_returns_tuple (line 22) | def test_bayesian_predict_returns_tuple(self, train_eval_split, tmp_pa... method test_variance_nonzero (line 50) | def test_variance_nonzero(self, train_eval_split, tmp_path): FILE: nobrainer/sr-tests/test_brain_generation.py class TestBrainGeneration (line 14) | class TestBrainGeneration: method test_generate_returns_nifti_images (line 17) | def test_generate_returns_nifti_images(self, sample_data): FILE: nobrainer/sr-tests/test_croissant_metadata.py class TestCroissantMetadata (line 9) | class TestCroissantMetadata: method test_segmentation_save_croissant_fields (line 12) | def test_segmentation_save_croissant_fields(self, train_eval_split, tm... method test_dataset_to_croissant (line 54) | def test_dataset_to_croissant(self, train_eval_split, tmp_path): FILE: nobrainer/sr-tests/test_dataset_builder.py class TestDatasetBuilder (line 6) | class TestDatasetBuilder: method test_from_files_batch_binarize_augment (line 9) | def test_from_files_batch_binarize_augment(self, train_eval_split): method test_split_sizes (line 32) | def test_split_sizes(self, train_eval_split): method test_streaming_mode_produces_patches (line 46) | def test_streaming_mode_produces_patches(self, train_eval_split): FILE: nobrainer/sr-tests/test_extract_patches.py class TestExtractPatches (line 10) | class TestExtractPatches: method volume_and_label (line 14) | def volume_and_label(self, train_eval_split): method test_binarize_true (line 22) | def test_binarize_true(self, volume_and_label): method test_binarize_set (line 36) | def test_binarize_set(self, volume_and_label): method test_binarize_callable (line 47) | def test_binarize_callable(self, volume_and_label): method test_patch_shapes (line 62) | def test_patch_shapes(self, volume_and_label): FILE: nobrainer/sr-tests/test_kwyk_smoke.py function _build_dataset (line 37) | def _build_dataset(sample_data): function _plot_learning_curve (line 49) | def _plot_learning_curve(losses, output_path): class TestKwykSmoke (line 68) | class TestKwykSmoke: method test_deterministic_meshnet_train (line 71) | def test_deterministic_meshnet_train(self, sample_data, tmp_path): method test_bayesian_warmstart_train (line 96) | def test_bayesian_warmstart_train(self, sample_data, tmp_path): method test_predict_output (line 179) | def test_predict_output(self, sample_data, tmp_path): FILE: nobrainer/sr-tests/test_raw_pytorch_api.py class TestRawPyTorchAPI (line 11) | class TestRawPyTorchAPI: method test_raw_train_predict_cycle (line 14) | def test_raw_train_predict_cycle(self, train_eval_split, tmp_path): FILE: nobrainer/sr-tests/test_segmentation_estimator.py class TestSegmentationEstimator (line 10) | class TestSegmentationEstimator: method test_fit_predict_returns_nifti (line 13) | def test_fit_predict_returns_nifti(self, train_eval_split, tmp_path): method test_save_creates_croissant (line 38) | def test_save_creates_croissant(self, train_eval_split, tmp_path): method test_load_roundtrip (line 66) | def test_load_roundtrip(self, train_eval_split, tmp_path): FILE: nobrainer/sr-tests/test_synthseg_brain.py class TestSynthSegBrain (line 13) | class TestSynthSegBrain: method test_generate_from_sample_data (line 16) | def test_generate_from_sample_data(self, sample_data): method test_two_samples_differ (line 44) | def test_two_samples_differ(self, sample_data): method test_label_structure_preserved (line 62) | def test_label_structure_preserved(self, sample_data): FILE: nobrainer/sr-tests/test_zarr_conversion.py function _mgz_to_nifti (line 14) | def _mgz_to_nifti(mgz_path: str, output_dir: Path) -> Path: class TestZarrConversion (line 22) | class TestZarrConversion: method test_nifti_to_zarr (line 25) | def test_nifti_to_zarr(self, train_eval_split, tmp_path): method test_zarr_to_nifti_roundtrip (line 43) | def test_zarr_to_nifti_roundtrip(self, train_eval_split, tmp_path): method test_multi_resolution_pyramid (line 64) | def test_multi_resolution_pyramid(self, train_eval_split, tmp_path): FILE: nobrainer/sr-tests/test_zarr_pipeline.py class TestZarrPipeline (line 14) | class TestZarrPipeline: method test_zarr_store_from_sample_data (line 17) | def test_zarr_store_from_sample_data(self, sample_data, tmp_path): method test_zarr_store_roundtrip (line 60) | def test_zarr_store_roundtrip(self, sample_data, tmp_path): FILE: nobrainer/tests/contract/test_cli.py function _help (line 13) | def _help(cmd: list[str]) -> str: class TestPredictCommand (line 26) | class TestPredictCommand: method test_predict_help_exits_zero (line 27) | def test_predict_help_exits_zero(self): method test_predict_has_model_option (line 30) | def test_predict_has_model_option(self): method test_predict_has_model_type_option (line 34) | def test_predict_has_model_type_option(self): method test_predict_has_n_classes_option (line 38) | def test_predict_has_n_classes_option(self): method test_predict_has_device_option (line 42) | def test_predict_has_device_option(self): method test_predict_has_n_samples_option (line 46) | def test_predict_has_n_samples_option(self): class TestGenerateCommand (line 51) | class TestGenerateCommand: method test_generate_help_exits_zero (line 52) | def test_generate_help_exits_zero(self): method test_generate_has_model_option (line 55) | def test_generate_has_model_option(self): method test_generate_has_model_type_option (line 59) | def test_generate_has_model_type_option(self): method test_generate_has_n_samples_option (line 63) | def test_generate_has_n_samples_option(self): method test_generate_has_latent_size_option (line 67) | def test_generate_has_latent_size_option(self): class TestConvertTfrecordsCommand (line 72) | class TestConvertTfrecordsCommand: method test_convert_tfrecords_help_exits_zero (line 73) | def test_convert_tfrecords_help_exits_zero(self): method test_convert_tfrecords_has_input_option (line 76) | def test_convert_tfrecords_has_input_option(self): method test_convert_tfrecords_has_output_dir_option (line 80) | def test_convert_tfrecords_has_output_dir_option(self): class TestResearchCommand (line 85) | class TestResearchCommand: method test_research_help_exits_zero (line 86) | def test_research_help_exits_zero(self): method test_research_has_working_dir_option (line 89) | def test_research_has_working_dir_option(self): method test_research_has_max_experiments_option (line 93) | def test_research_has_max_experiments_option(self): method test_research_has_budget_hours_option (line 97) | def test_research_has_budget_hours_option(self): class TestCommitCommand (line 102) | class TestCommitCommand: method test_commit_help_exits_zero (line 103) | def test_commit_help_exits_zero(self): method test_commit_has_model_path_option (line 106) | def test_commit_has_model_path_option(self): method test_commit_has_config_path_option (line 110) | def test_commit_has_config_path_option(self): method test_commit_has_val_dice_option (line 114) | def test_commit_has_val_dice_option(self): class TestInfoCommand (line 119) | class TestInfoCommand: method test_info_help_exits_zero (line 120) | def test_info_help_exits_zero(self): FILE: nobrainer/tests/gpu/test_bayesian_e2e.py function _make_sphere_volume (line 20) | def _make_sphere_volume(shape=(64, 64, 64), radius=20): class TestBayesianEndToEnd (line 34) | class TestBayesianEndToEnd: method test_bayesian_vnet_overfit_with_uncertainty (line 35) | def test_bayesian_vnet_overfit_with_uncertainty(self): FILE: nobrainer/tests/gpu/test_gan_e2e.py function _make_loader (line 19) | def _make_loader(n_samples=64, spatial=4, batch_size=4): class TestProgressiveGANEndToEnd (line 26) | class TestProgressiveGANEndToEnd: method test_extended_training_no_nan (line 27) | def test_extended_training_no_nan(self): method test_generated_output_shape (line 64) | def test_generated_output_shape(self): FILE: nobrainer/tests/gpu/test_multi_gpu.py class TestMultiGPU (line 27) | class TestMultiGPU: method test_ddp_fit_loss_decreases (line 28) | def test_ddp_fit_loss_decreases(self): method test_multi_gpu_predict_matches_single (line 56) | def test_multi_gpu_predict_matches_single(self): method test_ddp_speedup (line 82) | def test_ddp_speedup(self): FILE: nobrainer/tests/gpu/test_predict_e2e.py function _make_sphere_volume (line 23) | def _make_sphere_volume(shape=(64, 64, 64), radius=20): class TestPredictEndToEnd (line 37) | class TestPredictEndToEnd: method test_unet_overfit_dice_above_threshold (line 38) | def test_unet_overfit_dice_above_threshold(self): method test_predict_output_is_nifti_on_gpu (line 82) | def test_predict_output_is_nifti_on_gpu(self): FILE: nobrainer/tests/integration/test_datalad_commit.py function trained_models_dataset (line 22) | def trained_models_dataset(tmp_path): function model_files (line 33) | def model_files(tmp_path): class TestCommitBestModelIntegration (line 44) | class TestCommitBestModelIntegration: method test_files_committed_to_datalad (line 45) | def test_files_committed_to_datalad(self, trained_models_dataset, mode... method test_datalad_dataset_is_clean_after_commit (line 64) | def test_datalad_dataset_is_clean_after_commit( method test_git_log_contains_commit_message (line 85) | def test_git_log_contains_commit_message(self, trained_models_dataset,... method test_directory_structure_follows_convention (line 109) | def test_directory_structure_follows_convention( method test_model_card_contains_required_metadata (line 131) | def test_model_card_contains_required_metadata( method test_osf_push_skipped_gracefully_when_no_remote (line 153) | def test_osf_push_skipped_gracefully_when_no_remote( FILE: nobrainer/tests/integration/test_research_smoke.py class TestResearchSmoke (line 12) | class TestResearchSmoke: method test_research_loop_completes_with_budget_seconds (line 13) | def test_research_loop_completes_with_budget_seconds(self, tmp_path): FILE: nobrainer/tests/unit/test_bayesian_layers.py class TestBayesianConv3d (line 17) | class TestBayesianConv3d: method setup_method (line 18) | def setup_method(self): method _forward (line 21) | def _forward(self, layer, x): method test_output_shape (line 26) | def test_output_shape(self): method test_kl_populated_after_forward (line 32) | def test_kl_populated_after_forward(self): method test_kl_positive (line 39) | def test_kl_positive(self): method test_kl_varies_across_samples (line 45) | def test_kl_varies_across_samples(self): method test_prior_laplace (line 56) | def test_prior_laplace(self): method test_prior_spike_and_slab (line 62) | def test_prior_spike_and_slab(self): method test_no_bias (line 74) | def test_no_bias(self): method test_weight_sigma_positive (line 82) | def test_weight_sigma_positive(self): class TestBayesianLinear (line 92) | class TestBayesianLinear: method setup_method (line 93) | def setup_method(self): method _forward (line 96) | def _forward(self, layer, x): method test_output_shape (line 100) | def test_output_shape(self): method test_kl_populated (line 106) | def test_kl_populated(self): method test_no_bias (line 112) | def test_no_bias(self): method test_prior_laplace (line 119) | def test_prior_laplace(self): method test_prior_spike_and_slab (line 125) | def test_prior_spike_and_slab(self): class TestAccumulateKl (line 139) | class TestAccumulateKl: method setup_method (line 140) | def setup_method(self): method test_single_layer (line 143) | def test_single_layer(self): method test_multiple_layers (line 151) | def test_multiple_layers(self): method test_non_bayesian_model_returns_zero (line 171) | def test_non_bayesian_model_returns_zero(self): FILE: nobrainer/tests/unit/test_bayesian_models.py function _run (line 22) | def _run(model, x): class TestBayesianVNet (line 33) | class TestBayesianVNet: method setup_method (line 34) | def setup_method(self): method test_default_construction (line 37) | def test_default_construction(self): method test_output_shape_single_class (line 41) | def test_output_shape_single_class(self): method test_output_shape_multi_class (line 47) | def test_output_shape_multi_class(self): method test_kl_accumulated (line 53) | def test_kl_accumulated(self): method test_factory_function (line 60) | def test_factory_function(self): method test_laplace_prior (line 64) | def test_laplace_prior(self): method test_kl_weight_attribute (line 72) | def test_kl_weight_attribute(self): class TestBayesianMeshNet (line 82) | class TestBayesianMeshNet: method setup_method (line 83) | def setup_method(self): method test_default_construction (line 86) | def test_default_construction(self): method test_output_shape_single_class (line 90) | def test_output_shape_single_class(self): method test_output_shape_multi_class (line 96) | def test_output_shape_multi_class(self): method test_kl_accumulated (line 102) | def test_kl_accumulated(self): method test_invalid_receptive_field (line 108) | def test_invalid_receptive_field(self): method test_all_dilation_schedules (line 112) | def test_all_dilation_schedules(self): method test_factory_function (line 121) | def test_factory_function(self): method test_kl_weight_attribute (line 125) | def test_kl_weight_attribute(self): FILE: nobrainer/tests/unit/test_class_weights.py class TestComputeClassWeights (line 11) | class TestComputeClassWeights: method test_uniform_distribution (line 12) | def test_uniform_distribution(self, tmp_path): method test_imbalanced_gives_higher_weight_to_rare (line 25) | def test_imbalanced_gives_higher_weight_to_rare(self, tmp_path): method test_median_frequency_method (line 36) | def test_median_frequency_method(self, tmp_path): method test_max_samples (line 52) | def test_max_samples(self, tmp_path): class TestWeightedCrossEntropy (line 68) | class TestWeightedCrossEntropy: method test_with_weights (line 69) | def test_with_weights(self): method test_without_weights (line 78) | def test_without_weights(self): class TestDiceCELoss (line 86) | class TestDiceCELoss: method test_3d_segmentation (line 87) | def test_3d_segmentation(self): method test_with_class_weights (line 95) | def test_with_class_weights(self): method test_loss_registry (line 103) | def test_loss_registry(self): FILE: nobrainer/tests/unit/test_croissant.py function _make_nifti (line 24) | def _make_nifti(shape=(16, 16, 16), tmpdir: Path | None = None) -> str: function _make_fake_estimator (line 33) | def _make_fake_estimator(model_name="unet"): function _make_fake_dataset (line 46) | def _make_fake_dataset(tmp_path, n=2): class TestWriteModelCroissant (line 67) | class TestWriteModelCroissant: method test_creates_valid_jsonld (line 68) | def test_creates_valid_jsonld(self, tmp_path): method test_required_provenance_fields (line 86) | def test_required_provenance_fields(self, tmp_path): method test_provenance_model_architecture (line 105) | def test_provenance_model_architecture(self, tmp_path): method test_sha256_checksums_for_source_datasets (line 112) | def test_sha256_checksums_for_source_datasets(self, tmp_path): class TestSHA256 (line 125) | class TestSHA256: method test_checksum_computed (line 126) | def test_checksum_computed(self, tmp_path): method test_deterministic (line 133) | def test_deterministic(self, tmp_path): class TestValidateCroissant (line 144) | class TestValidateCroissant: method test_returns_true_on_valid (line 145) | def test_returns_true_on_valid(self, tmp_path): class TestWriteDatasetCroissant (line 158) | class TestWriteDatasetCroissant: method test_writes_dataset_metadata (line 159) | def test_writes_dataset_metadata(self, tmp_path): method test_dataset_info_present (line 169) | def test_dataset_info_present(self, tmp_path): method test_distribution_has_sha256 (line 178) | def test_distribution_has_sha256(self, tmp_path): FILE: nobrainer/tests/unit/test_dataset.py function _make_nifti (line 17) | def _make_nifti(shape=(16, 16, 16), tmpdir: Path | None = None) -> str: class TestGetDataset (line 33) | class TestGetDataset: method test_batch_shape_image_only (line 34) | def test_batch_shape_image_only(self, tmp_path): method test_batch_shape_with_labels (line 49) | def test_batch_shape_with_labels(self, tmp_path): method test_mismatch_raises (line 64) | def test_mismatch_raises(self, tmp_path): method test_augment_flag (line 75) | def test_augment_flag(self, tmp_path): method test_returns_dataloader (line 88) | def test_returns_dataloader(self, tmp_path): FILE: nobrainer/tests/unit/test_dataset_builder.py function _make_nifti (line 19) | def _make_nifti(shape=(16, 16, 16), tmpdir: Path | None = None) -> str: function _make_file_pairs (line 28) | def _make_file_pairs(n, shape, tmpdir): class TestFromFiles (line 43) | class TestFromFiles: method test_tuple_format (line 44) | def test_tuple_format(self, tmp_path): method test_dict_format (line 51) | def test_dict_format(self, tmp_path): method test_volume_shape_detected (line 58) | def test_volume_shape_detected(self, tmp_path): class TestFluentChaining (line 65) | class TestFluentChaining: method test_batch_returns_self (line 66) | def test_batch_returns_self(self, tmp_path): method test_shuffle_returns_self (line 72) | def test_shuffle_returns_self(self, tmp_path): method test_augment_returns_self (line 78) | def test_augment_returns_self(self, tmp_path): method test_chaining (line 84) | def test_chaining(self, tmp_path): class TestSplit (line 95) | class TestSplit: method test_split_sizes (line 96) | def test_split_sizes(self, tmp_path): method test_split_returns_datasets (line 104) | def test_split_returns_datasets(self, tmp_path): class TestDataloader (line 112) | class TestDataloader: method test_returns_dataloader (line 113) | def test_returns_dataloader(self, tmp_path): method test_batch_produces_data (line 120) | def test_batch_produces_data(self, tmp_path): class TestMetadataProperties (line 130) | class TestMetadataProperties: method test_batch_size (line 131) | def test_batch_size(self, tmp_path): method test_block_shape (line 136) | def test_block_shape(self, tmp_path): method test_volume_shape (line 141) | def test_volume_shape(self, tmp_path): method test_n_classes (line 146) | def test_n_classes(self, tmp_path): class TestToCroissant (line 152) | class TestToCroissant: method test_writes_valid_jsonld (line 153) | def test_writes_valid_jsonld(self, tmp_path): method test_has_dataset_info (line 164) | def test_has_dataset_info(self, tmp_path): FILE: nobrainer/tests/unit/test_datasets_openneuro.py class TestWriteManifest (line 11) | class TestWriteManifest: method test_creates_csv (line 14) | def test_creates_csv(self, tmp_path): method test_split_ratios (line 36) | def test_split_ratios(self, tmp_path): method test_dataset_id_column (line 56) | def test_dataset_id_column(self, tmp_path): class TestGlobDataset (line 77) | class TestGlobDataset: method test_finds_files (line 80) | def test_finds_files(self, tmp_path): method test_no_matches (line 91) | def test_no_matches(self, tmp_path): class TestExtractSubjectId (line 98) | class TestExtractSubjectId: method test_from_bids_path (line 99) | def test_from_bids_path(self, tmp_path): method test_from_filename (line 105) | def test_from_filename(self): class TestFileOk (line 112) | class TestFileOk: method test_real_file (line 113) | def test_real_file(self, tmp_path): method test_empty_file (line 120) | def test_empty_file(self, tmp_path): method test_missing_file (line 127) | def test_missing_file(self, tmp_path): class TestImportGuard (line 133) | class TestImportGuard: method test_install_without_datalad (line 136) | def test_install_without_datalad(self): FILE: nobrainer/tests/unit/test_estimator_generation.py class _FakeDataset (line 27) | class _FakeDataset: method __init__ (line 30) | def __init__(self, loader): method dataloader (line 35) | def dataloader(self): function _make_fake_dataset (line 39) | def _make_fake_dataset(n=4, spatial=SPATIAL, batch_size=2): class TestGenerationFit (line 51) | class TestGenerationFit: method test_fit_returns_self (line 52) | def test_fit_returns_self(self): method test_model_created_after_fit (line 64) | def test_model_created_after_fit(self): class TestGenerationGenerate (line 76) | class TestGenerationGenerate: method test_generate_returns_list_of_nifti (line 77) | def test_generate_returns_list_of_nifti(self): class TestGenerationSave (line 94) | class TestGenerationSave: method test_save_creates_croissant (line 95) | def test_save_creates_croissant(self, tmp_path): FILE: nobrainer/tests/unit/test_estimator_segmentation.py function _make_nifti (line 24) | def _make_nifti(shape=(16, 16, 16), tmpdir: Path | None = None) -> str: function _make_tiny_loader (line 33) | def _make_tiny_loader(n=4, spatial=SPATIAL, n_classes=N_CLASSES, batch_s... class _FakeDataset (line 41) | class _FakeDataset: method __init__ (line 44) | def __init__(self, loader, block_shape, volume_shape, n_classes): method block_shape (line 51) | def block_shape(self): method dataloader (line 55) | def dataloader(self): function _make_fake_dataset (line 59) | def _make_fake_dataset(n=4, spatial=SPATIAL, n_classes=N_CLASSES, batch_... class TestSegmentationFit (line 75) | class TestSegmentationFit: method test_fit_returns_self (line 76) | def test_fit_returns_self(self): method test_model_created_after_fit (line 87) | def test_model_created_after_fit(self): class TestSegmentationPredict (line 99) | class TestSegmentationPredict: method test_predict_returns_nifti (line 100) | def test_predict_returns_nifti(self, tmp_path): class TestSegmentationSaveLoad (line 117) | class TestSegmentationSaveLoad: method test_save_creates_files (line 118) | def test_save_creates_files(self, tmp_path): method test_croissant_provenance_fields (line 132) | def test_croissant_provenance_fields(self, tmp_path): method test_load_roundtrip (line 151) | def test_load_roundtrip(self, tmp_path): FILE: nobrainer/tests/unit/test_experiment.py class TestExperimentTracker (line 10) | class TestExperimentTracker: method test_local_logging (line 11) | def test_local_logging(self, tmp_path): method test_callback (line 33) | def test_callback(self, tmp_path): method test_no_wandb_by_default (line 49) | def test_no_wandb_by_default(self, tmp_path): FILE: nobrainer/tests/unit/test_generative.py function _tiny_loader (line 16) | def _tiny_loader(batch_size: int = 2, spatial: int = 4) -> DataLoader: class TestProgressiveGAN (line 27) | class TestProgressiveGAN: method test_construction (line 28) | def test_construction(self): method test_factory_function (line 34) | def test_factory_function(self): method test_generator_output_shape (line 40) | def test_generator_output_shape(self): method test_discriminator_output_shape (line 51) | def test_discriminator_output_shape(self): method test_training_step_losses_finite (line 60) | def test_training_step_losses_finite(self): method test_alpha_schedule (line 81) | def test_alpha_schedule(self): class TestDCGAN (line 99) | class TestDCGAN: method test_construction (line 100) | def test_construction(self): method test_factory_function (line 104) | def test_factory_function(self): method test_generator_output_shape (line 108) | def test_generator_output_shape(self): method test_discriminator_output_shape (line 115) | def test_discriminator_output_shape(self): method test_training_step_losses_finite (line 121) | def test_training_step_losses_finite(self): method test_configure_optimizers (line 135) | def test_configure_optimizers(self): FILE: nobrainer/tests/unit/test_gpu.py class TestGetDevice (line 10) | class TestGetDevice: method test_returns_torch_device (line 11) | def test_returns_torch_device(self): method test_device_type_known (line 15) | def test_device_type_known(self): class TestGpuCount (line 20) | class TestGpuCount: method test_returns_int (line 21) | def test_returns_int(self): class TestGpuInfo (line 27) | class TestGpuInfo: method test_returns_list (line 28) | def test_returns_list(self): class TestScaleForMultiGpu (line 37) | class TestScaleForMultiGpu: method test_no_gpu_returns_base (line 38) | def test_no_gpu_returns_base(self): method test_simple_division (line 46) | def test_simple_division(self): FILE: nobrainer/tests/unit/test_io_weights.py class _SimplePT (line 17) | class _SimplePT(nn.Module): method __init__ (line 20) | def __init__(self): method forward (line 25) | def forward(self, x): function _write_synthetic_h5 (line 29) | def _write_synthetic_h5(path: str, model: nn.Module) -> None: class TestConvertWeights (line 48) | class TestConvertWeights: method test_returns_dict (line 49) | def test_returns_dict(self, tmp_path): method test_output_pth_written (line 58) | def test_output_pth_written(self, tmp_path): method test_state_dict_keys_preserved (line 69) | def test_state_dict_keys_preserved(self, tmp_path): FILE: nobrainer/tests/unit/test_io_zarr.py function _make_nifti (line 14) | def _make_nifti(tmp_path, shape=(32, 32, 32)): class TestNiftiToZarr (line 24) | class TestNiftiToZarr: method test_creates_valid_store (line 25) | def test_creates_valid_store(self, tmp_path): method test_provenance_stored (line 33) | def test_provenance_stored(self, tmp_path): method test_multi_resolution_pyramid (line 44) | def test_multi_resolution_pyramid(self, tmp_path): class TestZarrToNifti (line 57) | class TestZarrToNifti: method test_round_trip_shape (line 58) | def test_round_trip_shape(self, tmp_path): method test_round_trip_data (line 66) | def test_round_trip_data(self, tmp_path): method test_round_trip_level1 (line 78) | def test_round_trip_level1(self, tmp_path): FILE: nobrainer/tests/unit/test_layers.py function x3d (line 22) | def x3d(): function x4d (line 27) | def x4d(): class TestBernoulliDropout (line 36) | class TestBernoulliDropout: method test_forward_shape (line 37) | def test_forward_shape(self, x3d): method test_passthrough_eval_scale (line 43) | def test_passthrough_eval_scale(self, x3d): method test_passthrough_eval_noscale (line 52) | def test_passthrough_eval_noscale(self, x3d): method test_gradient_flow (line 62) | def test_gradient_flow(self, x3d): method test_invalid_rate (line 71) | def test_invalid_rate(self): method test_mc_applies_in_eval (line 75) | def test_mc_applies_in_eval(self, x3d): class TestConcreteDropout (line 90) | class TestConcreteDropout: method test_forward_shape (line 91) | def test_forward_shape(self, x3d): method test_kl_positive (line 98) | def test_kl_positive(self, x3d): method test_gradient_flow (line 105) | def test_gradient_flow(self, x3d): method test_p_post_clipped (line 116) | def test_p_post_clipped(self, x3d): method test_passthrough_eval (line 122) | def test_passthrough_eval(self, x3d): class TestGaussianDropout (line 137) | class TestGaussianDropout: method test_forward_shape (line 138) | def test_forward_shape(self, x3d): method test_passthrough_eval (line 144) | def test_passthrough_eval(self, x3d): method test_gradient_flow (line 150) | def test_gradient_flow(self, x3d): method test_mc_in_eval (line 158) | def test_mc_in_eval(self, x3d): method test_invalid_rate (line 167) | def test_invalid_rate(self): class TestMaxPool4D (line 177) | class TestMaxPool4D: method test_forward_shape (line 178) | def test_forward_shape(self, x4d): method test_wrong_ndim (line 184) | def test_wrong_ndim(self): method test_pool_v (line 190) | def test_pool_v(self): method test_gradient_flow (line 196) | def test_gradient_flow(self, x4d): FILE: nobrainer/tests/unit/test_losses.py function _binary_pair (line 13) | def _binary_pair(batch=2, spatial=16): function _multiclass_pair (line 20) | def _multiclass_pair(batch=2, n_classes=3, spatial=8): class TestDiceLoss (line 36) | class TestDiceLoss: method test_returns_scalar (line 37) | def test_returns_scalar(self): method test_non_negative (line 43) | def test_non_negative(self): method test_perfect_prediction_near_zero (line 49) | def test_perfect_prediction_near_zero(self): class TestGeneralizedDiceLoss (line 61) | class TestGeneralizedDiceLoss: method test_returns_scalar (line 62) | def test_returns_scalar(self): method test_non_negative (line 68) | def test_non_negative(self): class TestJaccardLoss (line 80) | class TestJaccardLoss: method test_returns_scalar (line 81) | def test_returns_scalar(self): method test_non_negative (line 87) | def test_non_negative(self): class TestTverskyLoss (line 99) | class TestTverskyLoss: method test_returns_scalar (line 100) | def test_returns_scalar(self): method test_non_negative (line 106) | def test_non_negative(self): class TestStubs (line 118) | class TestStubs: method test_elbo_returns_tensor (line 119) | def test_elbo_returns_tensor(self): method test_wasserstein_returns_tensor (line 129) | def test_wasserstein_returns_tensor(self): class TestGet (line 144) | class TestGet: method test_known_loss (line 145) | def test_known_loss(self): method test_unknown_raises (line 149) | def test_unknown_raises(self): FILE: nobrainer/tests/unit/test_metrics.py function _onehot_pair (line 13) | def _onehot_pair(batch=2, n_classes=2, spatial=8): class TestDiceMetric (line 31) | class TestDiceMetric: method test_instantiation (line 32) | def test_instantiation(self): method test_perfect_score (line 36) | def test_perfect_score(self): method test_output_scalar (line 44) | def test_output_scalar(self): class TestJaccardMetric (line 57) | class TestJaccardMetric: method test_instantiation (line 58) | def test_instantiation(self): method test_perfect_score (line 62) | def test_perfect_score(self): class TestHausdorffMetric (line 76) | class TestHausdorffMetric: method test_instantiation (line 77) | def test_instantiation(self): method test_perfect_score_zero (line 81) | def test_perfect_score_zero(self): class TestGet (line 95) | class TestGet: method test_known_metric (line 96) | def test_known_metric(self): method test_unknown_raises (line 100) | def test_unknown_raises(self): FILE: nobrainer/tests/unit/test_model_interface.py class TestUnifiedForward (line 11) | class TestUnifiedForward: method test_meshnet (line 14) | def test_meshnet(self): method test_unet (line 20) | def test_unet(self): method test_segformer3d (line 26) | def test_segformer3d(self): class TestMcSupport (line 35) | class TestMcSupport: method test_kwyk_meshnet_supports_mc (line 38) | def test_kwyk_meshnet_supports_mc(self): method test_bayesian_meshnet_supports_mc (line 48) | def test_bayesian_meshnet_supports_mc(self): method test_regular_model_no_mc (line 60) | def test_regular_model_no_mc(self): method test_forward_helper_uses_explicit_check (line 64) | def test_forward_helper_uses_explicit_check(self): FILE: nobrainer/tests/unit/test_model_registry.py class TestSwinUNETR (line 10) | class TestSwinUNETR: method test_instantiate (line 11) | def test_instantiate(self): method test_output_shape (line 15) | def test_output_shape(self): class TestSegResNet (line 25) | class TestSegResNet: method test_instantiate (line 26) | def test_instantiate(self): method test_output_shape (line 30) | def test_output_shape(self): class TestRegistryAccess (line 37) | class TestRegistryAccess: method test_swin_unetr_in_registry (line 38) | def test_swin_unetr_in_registry(self): method test_segresnet_in_registry (line 43) | def test_segresnet_in_registry(self): FILE: nobrainer/tests/unit/test_models_segmentation.py function _grad_check (line 18) | def _grad_check(model: torch.nn.Module, inp: torch.Tensor) -> bool: class TestUNet (line 35) | class TestUNet: method test_output_shape_binary (line 36) | def test_output_shape_binary(self): method test_output_shape_multiclass (line 41) | def test_output_shape_multiclass(self): method test_gradient_flow (line 46) | def test_gradient_flow(self): method test_get_registry (line 51) | def test_get_registry(self): class TestVNet (line 61) | class TestVNet: method test_output_shape (line 62) | def test_output_shape(self): method test_gradient_flow (line 68) | def test_gradient_flow(self): class TestUNETR (line 79) | class TestUNETR: method test_output_shape (line 80) | def test_output_shape(self): class TestAttentionUNet (line 96) | class TestAttentionUNet: method test_output_shape (line 97) | def test_output_shape(self): method test_gradient_flow (line 106) | def test_gradient_flow(self): class TestMeshNet (line 121) | class TestMeshNet: method test_output_shape_binary (line 122) | def test_output_shape_binary(self): method test_output_shape_multiclass (line 127) | def test_output_shape_multiclass(self): method test_receptive_field_37 (line 132) | def test_receptive_field_37(self): method test_receptive_field_129 (line 137) | def test_receptive_field_129(self): method test_invalid_rf (line 142) | def test_invalid_rf(self): method test_gradient_flow (line 146) | def test_gradient_flow(self): class TestHighResNet (line 157) | class TestHighResNet: method test_output_shape_binary (line 158) | def test_output_shape_binary(self): method test_output_shape_multiclass (line 163) | def test_output_shape_multiclass(self): method test_gradient_flow (line 168) | def test_gradient_flow(self): class TestAutoencoder (line 179) | class TestAutoencoder: method test_output_shape (line 181) | def test_output_shape(self): method test_encode_shape (line 187) | def test_encode_shape(self): method test_gradient_flow (line 193) | def test_gradient_flow(self): class TestSimSiam (line 204) | class TestSimSiam: method test_forward_shapes (line 206) | def test_forward_shapes(self): method test_loss_negative_range (line 214) | def test_loss_negative_range(self): method test_gradient_flow (line 223) | def test_gradient_flow(self): FILE: nobrainer/tests/unit/test_prediction.py class _IdentityModel (line 19) | class _IdentityModel(nn.Module): method __init__ (line 22) | def __init__(self): method forward (line 26) | def forward(self, x): class _MultiClassModel (line 30) | class _MultiClassModel(nn.Module): method __init__ (line 33) | def __init__(self): method forward (line 37) | def forward(self, x): function _make_nifti (line 41) | def _make_nifti(shape=(32, 32, 32), tmp_path=None) -> str: class TestPredict (line 56) | class TestPredict: method test_returns_nifti (line 57) | def test_returns_nifti(self, tmp_path): method test_output_shape_matches_input (line 63) | def test_output_shape_matches_input(self, tmp_path): method test_ndarray_input (line 69) | def test_ndarray_input(self): method test_nifti_image_input (line 75) | def test_nifti_image_input(self): method test_affine_preserved (line 82) | def test_affine_preserved(self, tmp_path): method test_return_probabilities (line 89) | def test_return_probabilities(self): method test_non_block_aligned_input (line 98) | def test_non_block_aligned_input(self): class TestPredictWithUncertainty (line 111) | class TestPredictWithUncertainty: method test_returns_three_niftis (line 112) | def test_returns_three_niftis(self): method test_output_shapes_match_input (line 122) | def test_output_shapes_match_input(self): method test_variance_nonnegative (line 132) | def test_variance_nonnegative(self): method test_entropy_nonnegative (line 140) | def test_entropy_nonnegative(self): FILE: nobrainer/tests/unit/test_research_commit.py function _make_model_files (line 12) | def _make_model_files(tmp_path: Path) -> tuple[Path, Path]: class TestCommitBestModel (line 21) | class TestCommitBestModel: method test_directory_structure_created (line 22) | def test_directory_structure_created(self, tmp_path): method test_model_card_contains_required_fields (line 52) | def test_model_card_contains_required_fields(self, tmp_path): method test_model_version_dict_fields (line 80) | def test_model_version_dict_fields(self, tmp_path): method test_datalad_commit_message_in_result (line 108) | def test_datalad_commit_message_in_result(self, tmp_path): method test_result_contains_osf_url_key (line 132) | def test_result_contains_osf_url_key(self, tmp_path): method test_datalad_not_installed_raises_import_error (line 154) | def test_datalad_not_installed_raises_import_error(self, tmp_path): FILE: nobrainer/tests/unit/test_research_loop.py function _write_train_script (line 27) | def _write_train_script(path: Path, config: dict | None = None) -> None: function _write_val_dice (line 35) | def _write_val_dice(path: Path, val_dice: float) -> None: class TestHelpers (line 44) | class TestHelpers: method test_parse_config_comment (line 45) | def test_parse_config_comment(self, tmp_path): method test_parse_config_comment_missing (line 51) | def test_parse_config_comment_missing(self, tmp_path): method test_patch_config (line 57) | def test_patch_config(self, tmp_path): method test_patch_config_adds_when_missing (line 66) | def test_patch_config_adds_when_missing(self, tmp_path): method test_read_val_dice_valid (line 73) | def test_read_val_dice_valid(self, tmp_path): method test_read_val_dice_missing (line 77) | def test_read_val_dice_missing(self, tmp_path): method test_has_nan (line 80) | def test_has_nan(self): method test_classify_failure_oom (line 84) | def test_classify_failure_oom(self): method test_classify_failure_nan (line 87) | def test_classify_failure_nan(self): method test_classify_failure_generic (line 90) | def test_classify_failure_generic(self): method test_write_summary (line 93) | def test_write_summary(self, tmp_path): class TestRunLoop (line 109) | class TestRunLoop: method test_keep_improved_experiment (line 110) | def test_keep_improved_experiment(self, tmp_path): method test_revert_on_degraded (line 139) | def test_revert_on_degraded(self, tmp_path): method test_failure_handling_reverts (line 175) | def test_failure_handling_reverts(self, tmp_path): method test_run_summary_written (line 198) | def test_run_summary_written(self, tmp_path): method test_missing_train_script_raises (line 217) | def test_missing_train_script_raises(self, tmp_path): method test_budget_seconds_terminates_quickly (line 221) | def test_budget_seconds_terminates_quickly(self, tmp_path): FILE: nobrainer/tests/unit/test_segformer3d.py class TestSegFormer3DShapes (line 11) | class TestSegFormer3DShapes: method test_output_shape_32 (line 12) | def test_output_shape_32(self): method test_output_shape_64 (line 20) | def test_output_shape_64(self): method test_batch_size_2 (line 28) | def test_batch_size_2(self): class TestSegFormer3DParams (line 37) | class TestSegFormer3DParams: method test_default_param_count (line 38) | def test_default_param_count(self): method test_tiny_param_count (line 44) | def test_tiny_param_count(self): method test_base_param_count (line 50) | def test_base_param_count(self): class TestSegFormer3DRegistry (line 57) | class TestSegFormer3DRegistry: method test_accessible_via_get (line 58) | def test_accessible_via_get(self): method test_in_available_models (line 63) | def test_in_available_models(self): method test_factory_defaults (line 68) | def test_factory_defaults(self): FILE: nobrainer/tests/unit/test_slurm.py class TestSlurmPreemptionHandler (line 10) | class TestSlurmPreemptionHandler: method test_initial_state (line 11) | def test_initial_state(self): method test_is_slurm_job (line 15) | def test_is_slurm_job(self): class TestCheckpoint (line 20) | class TestCheckpoint: method test_save_and_load (line 21) | def test_save_and_load(self, tmp_path): method test_load_no_checkpoint (line 39) | def test_load_no_checkpoint(self, tmp_path): method test_model_weights_restored (line 45) | def test_model_weights_restored(self, tmp_path): FILE: nobrainer/tests/unit/test_stride_patches.py class TestStridedPatchPositions (line 10) | class TestStridedPatchPositions: method test_non_overlapping_count (line 11) | def test_non_overlapping_count(self): method test_overlapping_more_patches (line 16) | def test_overlapping_more_patches(self): method test_patch_shapes_valid (line 22) | def test_patch_shapes_valid(self): method test_stride_equals_block_default (line 33) | def test_stride_equals_block_default(self): class TestReassemblePredictions (line 39) | class TestReassemblePredictions: method test_non_overlapping_perfect_reconstruction (line 40) | def test_non_overlapping_perfect_reconstruction(self): method test_overlapping_average (line 60) | def test_overlapping_average(self): method test_output_shape (line 81) | def test_output_shape(self): FILE: nobrainer/tests/unit/test_synthseg.py function _make_label_map (line 13) | def _make_label_map(tmp_path: Path, shape=(32, 32, 32)) -> str: class TestTissueClasses (line 27) | class TestTissueClasses: method test_all_50class_labels_covered (line 28) | def test_all_50class_labels_covered(self): method test_no_label_in_multiple_classes (line 41) | def test_no_label_in_multiple_classes(self): class TestGMMGrouping (line 53) | class TestGMMGrouping: method test_within_class_same_distribution (line 54) | def test_within_class_same_distribution(self, tmp_path): method test_different_classes_differ (line 83) | def test_different_classes_differ(self, tmp_path): method test_two_runs_produce_different_intensities (line 108) | def test_two_runs_produce_different_intensities(self, tmp_path): class TestSpatialAugmentation (line 125) | class TestSpatialAugmentation: method test_elastic_changes_geometry (line 126) | def test_elastic_changes_geometry(self, tmp_path): method test_label_nearest_neighbor (line 151) | def test_label_nearest_neighbor(self, tmp_path): method test_flipping_swaps_lr (line 179) | def test_flipping_swaps_lr(self, tmp_path): class TestResolutionRandomization (line 210) | class TestResolutionRandomization: method test_blurs_image (line 211) | def test_blurs_image(self, tmp_path): class TestOutputFormat (line 248) | class TestOutputFormat: method test_returns_dict_with_correct_keys (line 249) | def test_returns_dict_with_correct_keys(self, tmp_path): method test_correct_length (line 262) | def test_correct_length(self, tmp_path): class TestMixedDataset (line 270) | class TestMixedDataset: method test_mix_ratio (line 271) | def test_mix_ratio(self, tmp_path): method test_dataset_mix_method (line 297) | def test_dataset_mix_method(self, tmp_path): FILE: nobrainer/tests/unit/test_training.py function _make_loader (line 12) | def _make_loader(n=8, spatial=8, n_classes=2, batch_size=2): function _make_model (line 20) | def _make_model(n_classes=2): class TestFit (line 29) | class TestFit: method test_returns_correct_keys (line 30) | def test_returns_correct_keys(self): method test_loss_decreases (line 44) | def test_loss_decreases(self): method test_checkpoint_created (line 60) | def test_checkpoint_created(self, tmp_path): method test_checkpoint_croissant_content (line 75) | def test_checkpoint_croissant_content(self, tmp_path): method test_epochs_completed (line 96) | def test_epochs_completed(self): method test_dict_batch_format (line 108) | def test_dict_batch_format(self): FILE: nobrainer/tests/unit/test_training_convergence.py function _run_epochs (line 26) | def _run_epochs(model: torch.nn.Module, seed: int = 42) -> list[float]: class TestTrainingConvergence (line 45) | class TestTrainingConvergence: method test_unet_loss_decreases (line 48) | def test_unet_loss_decreases(self): method test_vnet_loss_decreases (line 54) | def test_vnet_loss_decreases(self): method test_attention_unet_loss_decreases (line 60) | def test_attention_unet_loss_decreases(self): method test_meshnet_loss_decreases (line 66) | def test_meshnet_loss_decreases(self): method test_highresnet_loss_decreases (line 72) | def test_highresnet_loss_decreases(self): FILE: nobrainer/tests/unit/test_transform_pipeline.py function _identity (line 8) | def _identity(data): function _augment (line 14) | def _augment(data): class TestAugmentation (line 20) | class TestAugmentation: method test_wraps_transform (line 21) | def test_wraps_transform(self): method test_repr (line 27) | def test_repr(self): class TestTrainableCompose (line 32) | class TestTrainableCompose: method test_train_mode_runs_all (line 33) | def test_train_mode_runs_all(self): method test_predict_mode_skips_augmentation (line 39) | def test_predict_mode_skips_augmentation(self): method test_default_mode_is_train (line 45) | def test_default_mode_is_train(self): method test_mode_setter (line 50) | def test_mode_setter(self): method test_multiple_augmentations_skipped (line 56) | def test_multiple_augmentations_skipped(self): method test_train_mode_runs_multiple_augmentations (line 69) | def test_train_mode_runs_multiple_augmentations(self): method test_empty_pipeline (line 82) | def test_empty_pipeline(self): class TestAugmentationProfiles (line 88) | class TestAugmentationProfiles: method test_none_returns_empty (line 89) | def test_none_returns_empty(self): method test_standard_returns_augmentations (line 95) | def test_standard_returns_augmentations(self): method test_all_profiles_valid (line 102) | def test_all_profiles_valid(self): method test_unknown_profile_raises (line 109) | def test_unknown_profile_raises(self): FILE: nobrainer/tests/unit/test_vwn_layers.py class TestFFGConv3d (line 10) | class TestFFGConv3d: method test_output_shape (line 11) | def test_output_shape(self): method test_deterministic_mode (line 17) | def test_deterministic_mode(self): method test_stochastic_mode_varies (line 25) | def test_stochastic_mode_varies(self): method test_kl_populated_after_mc (line 33) | def test_kl_populated_after_mc(self): method test_kernel_m_shape (line 39) | def test_kernel_m_shape(self): method test_no_bias (line 43) | def test_no_bias(self): method test_sigma_positive (line 50) | def test_sigma_positive(self): class TestConcreteDropout3d (line 55) | class TestConcreteDropout3d: method test_output_shape (line 56) | def test_output_shape(self): method test_deterministic_scales (line 62) | def test_deterministic_scales(self): method test_p_in_range (line 71) | def test_p_in_range(self): method test_regularization_positive (line 76) | def test_regularization_positive(self): class TestKWYKMeshNet (line 82) | class TestKWYKMeshNet: method test_bernoulli_variant (line 83) | def test_bernoulli_variant(self): method test_concrete_variant (line 96) | def test_concrete_variant(self): method test_kl_divergence (line 109) | def test_kl_divergence(self): method test_concrete_regularization (line 118) | def test_concrete_regularization(self): method test_deterministic_forward (line 130) | def test_deterministic_forward(self): method test_factory_function (line 140) | def test_factory_function(self): FILE: nobrainer/tests/unit/test_zarr_dataset.py function _make_zarr_pair (line 16) | def _make_zarr_pair(tmp_path, shape=(32, 32, 32)): class TestIsZarrPath (line 32) | class TestIsZarrPath: method test_zarr_extension (line 33) | def test_zarr_extension(self): method test_non_zarr (line 37) | def test_non_zarr(self): class TestZarrDataset (line 42) | class TestZarrDataset: method test_returns_dict_with_image (line 43) | def test_returns_dict_with_image(self, tmp_path): method test_image_shape_has_channel (line 50) | def test_image_shape_has_channel(self, tmp_path): method test_returns_label_when_provided (line 57) | def test_returns_label_when_provided(self, tmp_path): method test_batch_from_dataloader (line 64) | def test_batch_from_dataloader(self, tmp_path): method test_multi_resolution_level (line 73) | def test_multi_resolution_level(self, tmp_path): FILE: nobrainer/tests/unit/test_zarr_store.py function _make_nifti_pair (line 12) | def _make_nifti_pair(tmp_path, idx, shape=(32, 32, 32)): class TestCreateZarrStore (line 25) | class TestCreateZarrStore: method test_creates_store (line 26) | def test_creates_store(self, tmp_path): method test_stacked_4d_layout (line 37) | def test_stacked_4d_layout(self, tmp_path): method test_metadata_stored (line 55) | def test_metadata_stored(self, tmp_path): method test_round_trip_fidelity (line 72) | def test_round_trip_fidelity(self, tmp_path): method test_partial_io (line 86) | def test_partial_io(self, tmp_path): method test_auto_conform (line 99) | def test_auto_conform(self, tmp_path): method test_non_uniform_without_conform_raises (line 123) | def test_non_uniform_without_conform_raises(self, tmp_path): class TestPartition (line 134) | class TestPartition: method test_create_partition (line 135) | def test_create_partition(self, tmp_path): method test_load_partition (line 149) | def test_load_partition(self, tmp_path): method test_different_seeds_produce_different_splits (line 167) | def test_different_seeds_produce_different_splits(self, tmp_path): FILE: nobrainer/training.py function get_device (line 16) | def get_device() -> torch.device: function _run_validation (line 27) | def _run_validation( function _apply_gradient_checkpointing (line 96) | def _apply_gradient_checkpointing(model: nn.Module) -> None: function _apply_model_parallel (line 127) | def _apply_model_parallel(model: nn.Module, gpus: int) -> nn.Module: function fit (line 207) | def fit( function _ddp_worker (line 415) | def _ddp_worker( function _fit_ddp (line 580) | def _fit_ddp( FILE: nobrainer/utils.py function _sha256 (line 16) | def _sha256(path: str) -> str: function _download_if_needed (line 25) | def _download_if_needed(url: str, dest: str, expected_hash: str) -> None: function get_data (line 38) | def get_data(cache_dir=_cache_dir): class StreamingStats (line 138) | class StreamingStats: method __init__ (line 165) | def __init__(self): method update (line 170) | def update(self, value): method mean (line 194) | def mean(self): method var (line 198) | def var(self): method std (line 202) | def std(self): method entropy (line 206) | def entropy(self): function get_num_parallel (line 214) | def get_num_parallel(): FILE: nobrainer/validation.py function validate_from_filepath (line 16) | def validate_from_filepath( function get_dice_for_images (line 81) | def get_dice_for_images(pred, gt, n_classes): function validate_from_filepaths (line 101) | def validate_from_filepaths( FILE: scripts/kwyk_reproduction/01_assemble_dataset.py function main (line 26) | def main(): FILE: scripts/kwyk_reproduction/02_train_meshnet.py function parse_args (line 25) | def parse_args() -> argparse.Namespace: function load_manifest (line 63) | def load_manifest(manifest_path: str, split: str) -> list[tuple[str, str]]: function evaluate_val_dice (line 74) | def evaluate_val_dice( function plot_learning_curve (line 139) | def plot_learning_curve( function main (line 175) | def main() -> None: FILE: scripts/kwyk_reproduction/03_train_bayesian.py class ELBOLoss (line 50) | class ELBOLoss(nn.Module): method __init__ (line 64) | def __init__( method forward (line 76) | def forward(self, pred: torch.Tensor, target: torch.Tensor) -> torch.T... function parse_args (line 88) | def parse_args() -> argparse.Namespace: function load_manifest (line 141) | def load_manifest(manifest_path: str, split: str) -> list[tuple[str, str]]: function evaluate_mc_dice (line 155) | def evaluate_mc_dice( function plot_learning_curve (line 240) | def plot_learning_curve( function train_bayesian (line 307) | def train_bayesian( function main (line 506) | def main() -> None: FILE: scripts/kwyk_reproduction/04_evaluate.py function parse_args (line 32) | def parse_args() -> argparse.Namespace: function load_manifest (line 43) | def load_manifest(manifest_path: str, split: str) -> list[tuple[str, str]]: function per_class_dice (line 52) | def per_class_dice( function compute_entropy (line 93) | def compute_entropy(prob_map: np.ndarray) -> np.ndarray: function plot_prediction_overlay (line 102) | def plot_prediction_overlay( function plot_per_class_dice (line 150) | def plot_per_class_dice( function main (line 175) | def main() -> None: FILE: scripts/kwyk_reproduction/05_compare_kwyk.py function parse_args (line 31) | def parse_args() -> argparse.Namespace: function load_manifest (line 69) | def load_manifest(manifest_path: str, split: str) -> list[tuple[str, str]]: function run_kwyk_prediction (line 83) | def run_kwyk_prediction( function compute_spatial_correlation (line 143) | def compute_spatial_correlation(map1: np.ndarray, map2: np.ndarray) -> f... function plot_dice_scatter (line 178) | def plot_dice_scatter( function main (line 211) | def main() -> None: FILE: scripts/kwyk_reproduction/06_block_size_sweep.py function parse_args (line 28) | def parse_args() -> argparse.Namespace: function load_manifest (line 67) | def load_manifest(manifest_path: str, split: str) -> list[tuple[str, str]]: function train_and_evaluate (line 81) | def train_and_evaluate( function plot_block_size_comparison (line 224) | def plot_block_size_comparison( function main (line 274) | def main() -> None: FILE: scripts/kwyk_reproduction/build_kwyk_manifest.py function main (line 21) | def main(): FILE: scripts/kwyk_reproduction/convert_zarr_shard.py function main (line 23) | def main(): FILE: scripts/kwyk_reproduction/experiments/01_20260330_eval_deterministic/eval_deterministic.py function per_class_dice (line 23) | def per_class_dice(pred: np.ndarray, gt: np.ndarray, n_classes: int) -> ... function predict_volume (line 35) | def predict_volume(model, img_path, block_shape, mc=False): function main (line 64) | def main(): FILE: scripts/kwyk_reproduction/experiments/02_20260330_binary_bayesian/eval_binary.py function predict_volume (line 23) | def predict_volume(model, img_path, block_shape, mc=False): function main (line 55) | def main(): FILE: scripts/kwyk_reproduction/experiments/03_20260330_warmstart_diagnostic/diagnose.py function predict_volume_simple (line 23) | def predict_volume_simple(model, img_path, block_shape, mc=False): function main (line 55) | def main(): FILE: scripts/kwyk_reproduction/experiments/04_20260330_fixed_warmstart/run.py function fixed_warmstart_kwyk (line 24) | def fixed_warmstart_kwyk(kwyk_model, det_weights_path): function predict_volume (line 79) | def predict_volume(model, img_path, block_shape, mc=False): function per_class_dice (line 111) | def per_class_dice(pred, gt, n_classes): function main (line 122) | def main(): FILE: scripts/kwyk_reproduction/experiments/05_20260330_kwyk_from_scratch/run.py function predict_volume (line 25) | def predict_volume(model, img_path, block_shape, mc=False): function per_class_dice (line 50) | def per_class_dice(pred, gt, n_classes): function binary_dice (line 61) | def binary_dice(pred, gt): function train_kwyk (line 69) | def train_kwyk(name, n_classes, label_mapping, mc_train, epochs=50): function main (line 189) | def main(): FILE: scripts/kwyk_reproduction/utils.py function load_config (line 15) | def load_config(path: str | Path) -> dict[str, Any]: function setup_logging (line 35) | def setup_logging(name: str) -> logging.Logger: function save_figure (line 61) | def save_figure(fig: Any, path: str | Path) -> None: function compute_dice (line 76) | def compute_dice(pred: np.ndarray, label: np.ndarray) -> float: function apply_label_mapping (line 100) | def apply_label_mapping( class SlurmPreemptionHandler (line 146) | class SlurmPreemptionHandler: method __init__ (line 165) | def __init__(self, sig: int = signal.SIGUSR1) -> None: method _handle (line 171) | def _handle(self, signum: int, frame: Any) -> None: function save_training_checkpoint (line 178) | def save_training_checkpoint( function load_training_checkpoint (line 235) | def load_training_checkpoint( FILE: scripts/synthseg_evaluation/02_train.py function parse_args (line 23) | def parse_args(): function load_manifest (line 34) | def load_manifest(path, split): function main (line 43) | def main(): FILE: scripts/synthseg_evaluation/03_evaluate.py function per_class_dice (line 25) | def per_class_dice(pred, gt, n_classes): function main (line 37) | def main(): FILE: scripts/synthseg_evaluation/04_compare.py function main (line 21) | def main():