Skip to content

Commit

Permalink
Merge pull request #78 from Manonedde/fix_betcropvolume
Browse files Browse the repository at this point in the history
#45 - Change category cropvolume module (move to image) [WIP]
  • Loading branch information
AlexVCaron authored Jan 15, 2025
2 parents 5c2bc5c + 64d5fb0 commit 38949cc
Show file tree
Hide file tree
Showing 20 changed files with 85 additions and 85 deletions.
2 changes: 0 additions & 2 deletions modules/nf-neuro/betcrop/cropvolume/tests/tags.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
channels: []
dependencies: []
name: betcrop_cropvolume
name: image_cropvolume
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

process BETCROP_CROPVOLUME {
process IMAGE_CROPVOLUME {
tag "$meta.id"
label 'process_single'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/scilus/nf-neuro/main/modules/meta-schema.json
name: "betcrop_cropvolume"
name: "image_cropvolume"
description: Crop empty planes around the data in a volume
keywords:
- nifti
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
nextflow_process {

name "Test Process BETCROP_CROPVOLUME"
name "Test Process IMAGE_CROPVOLUME"
script "../main.nf"
process "BETCROP_CROPVOLUME"
process "IMAGE_CROPVOLUME"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "betcrop"
tag "betcrop/cropvolume"
tag "image"
tag "image/cropvolume"

tag "subworkflows"
tag "subworkflows/load_test_data"
Expand All @@ -25,7 +25,7 @@ nextflow_process {
}
}

test("betcrop - cropvolume") {
test("image - cropvolume") {

when {
process {
Expand All @@ -50,7 +50,7 @@ nextflow_process {

}

test("betcrop - cropvolume - outputbbox") {
test("image - cropvolume - outputbbox") {

config "./nextflow_bbox.config"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"betcrop - cropvolume - outputbbox": {
"image - cropvolume": {
"content": [
{
"0": [
Expand All @@ -12,25 +12,13 @@
]
],
"1": [
[
{
"id": "test",
"single_end": false
},
"test_cropped_bbox.pkl:md5,d6a03b61669b07683e8c4b21a613f16c"
]

],
"2": [
"versions.yml:md5,3b089d55a1116feffa69d739ced1d99f"
"versions.yml:md5,c9f9039fc9103e716e831016a61807f9"
],
"bounding_box": [
[
{
"id": "test",
"single_end": false
},
"test_cropped_bbox.pkl:md5,d6a03b61669b07683e8c4b21a613f16c"
]

],
"image": [
[
Expand All @@ -42,17 +30,17 @@
]
],
"versions": [
"versions.yml:md5,3b089d55a1116feffa69d739ced1d99f"
"versions.yml:md5,c9f9039fc9103e716e831016a61807f9"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
"nextflow": "24.10.0"
},
"timestamp": "2024-10-28T19:30:09.320626173"
"timestamp": "2024-12-12T18:59:41.317523464"
},
"betcrop - cropvolume": {
"image - cropvolume - outputbbox": {
"content": [
{
"0": [
Expand All @@ -65,13 +53,25 @@
]
],
"1": [

[
{
"id": "test",
"single_end": false
},
"test_cropped_bbox.pkl:md5,d6a03b61669b07683e8c4b21a613f16c"
]
],
"2": [
"versions.yml:md5,3b089d55a1116feffa69d739ced1d99f"
"versions.yml:md5,c9f9039fc9103e716e831016a61807f9"
],
"bounding_box": [

[
{
"id": "test",
"single_end": false
},
"test_cropped_bbox.pkl:md5,d6a03b61669b07683e8c4b21a613f16c"
]
],
"image": [
[
Expand All @@ -83,14 +83,14 @@
]
],
"versions": [
"versions.yml:md5,3b089d55a1116feffa69d739ced1d99f"
"versions.yml:md5,c9f9039fc9103e716e831016a61807f9"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
"nextflow": "24.10.0"
},
"timestamp": "2024-10-28T19:30:00.033087617"
"timestamp": "2024-12-12T18:59:50.080977383"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
process {
withName: "BETCROP_CROPVOLUME" {
withName: "IMAGE_CROPVOLUME" {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
process {
withName: "BETCROP_CROPVOLUME" {
withName: "IMAGE_CROPVOLUME" {
ext.output_bbox = true
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}
Expand Down
2 changes: 2 additions & 0 deletions modules/nf-neuro/image/cropvolume/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
image/cropvolume:
- "modules/nf-neuro/image/cropvolume/**"
8 changes: 4 additions & 4 deletions subworkflows/nf-neuro/preproc_dwi/main.nf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include { DENOISING_MPPCA as DENOISE_DWI } from '../../../modules/nf-neuro/denoising/mppca/main'
include { DENOISING_MPPCA as DENOISE_REVDWI } from '../../../modules/nf-neuro/denoising/mppca/main'
include { BETCROP_FSLBETCROP } from '../../../modules/nf-neuro/betcrop/fslbetcrop/main'
include { BETCROP_CROPVOLUME } from '../../../modules/nf-neuro/betcrop/cropvolume/main'
include { IMAGE_CROPVOLUME } from '../../../modules/nf-neuro/image/cropvolume/main'
include { PREPROC_N4 as N4_DWI } from '../../../modules/nf-neuro/preproc/n4/main'
include { PREPROC_NORMALIZE as NORMALIZE_DWI } from '../../../modules/nf-neuro/preproc/normalize/main'
include { IMAGE_RESAMPLE as RESAMPLE_DWI } from '../../../modules/nf-neuro/image/resample/main'
Expand Down Expand Up @@ -78,12 +78,12 @@ workflow PREPROC_DWI {
ch_crop_b0 = TOPUP_EDDY.out.b0
.join(BETCROP_FSLBETCROP.out.bbox)

BETCROP_CROPVOLUME ( ch_crop_b0 )
ch_versions = ch_versions.mix(BETCROP_CROPVOLUME.out.versions.first())
IMAGE_CROPVOLUME ( ch_crop_b0 )
ch_versions = ch_versions.mix(IMAGE_CROPVOLUME.out.versions.first())

// ** N4 DWI ** //
ch_N4 = BETCROP_FSLBETCROP.out.image
.join(BETCROP_CROPVOLUME.out.image)
.join(IMAGE_CROPVOLUME.out.image)
.join(BETCROP_FSLBETCROP.out.mask)

N4_DWI ( ch_N4 )
Expand Down
2 changes: 1 addition & 1 deletion subworkflows/nf-neuro/preproc_dwi/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ keywords:
- Normalization
- Resampling
components:
- betcrop/cropvolume
- image/cropvolume
- betcrop/fslbetcrop
- denoising/mppca
- image/resample
Expand Down
2 changes: 1 addition & 1 deletion subworkflows/nf-neuro/preproc_dwi/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ nextflow_workflow {
tag "subworkflows_nfcore"
tag "subworkflows/preproc_dwi"
tag "subworkflows/topup_eddy"
tag "betcrop/cropvolume"
tag "image/cropvolume"
tag "betcrop/fslbetcrop"
tag "denoising/mppca"
tag "image/resample"
Expand Down
8 changes: 4 additions & 4 deletions subworkflows/nf-neuro/preproc_dwi/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"versions.yml:md5,0280006ceecc575513278292734ffb27",
"versions.yml:md5,0494fbf74bc9c16d2b30cb45b3bba66b",
"versions.yml:md5,0b8c908e52917b0b706fc9d1b4d6cd24",
"versions.yml:md5,0e680a0c6b56892e1a7ec7f85bb95322",
"versions.yml:md5,10ec368dc91791041043fddf6ea3d5c9",
"versions.yml:md5,571265e710ca29198e69be22c0f970d5",
"versions.yml:md5,662ea558da42564a0f6140473132bcb4",
"versions.yml:md5,7ddf2e98f59b19c9b933670550f26ad7",
Expand Down Expand Up @@ -51,7 +51,7 @@
"versions.yml:md5,0280006ceecc575513278292734ffb27",
"versions.yml:md5,0494fbf74bc9c16d2b30cb45b3bba66b",
"versions.yml:md5,0b8c908e52917b0b706fc9d1b4d6cd24",
"versions.yml:md5,0e680a0c6b56892e1a7ec7f85bb95322",
"versions.yml:md5,10ec368dc91791041043fddf6ea3d5c9",
"versions.yml:md5,571265e710ca29198e69be22c0f970d5",
"versions.yml:md5,7ddf2e98f59b19c9b933670550f26ad7",
"versions.yml:md5,c15ba5efd24564dba4710b6da8c4b791",
Expand Down Expand Up @@ -87,7 +87,7 @@
"versions.yml:md5,0280006ceecc575513278292734ffb27",
"versions.yml:md5,0494fbf74bc9c16d2b30cb45b3bba66b",
"versions.yml:md5,0b8c908e52917b0b706fc9d1b4d6cd24",
"versions.yml:md5,0e680a0c6b56892e1a7ec7f85bb95322",
"versions.yml:md5,10ec368dc91791041043fddf6ea3d5c9",
"versions.yml:md5,571265e710ca29198e69be22c0f970d5",
"versions.yml:md5,662ea558da42564a0f6140473132bcb4",
"versions.yml:md5,7ddf2e98f59b19c9b933670550f26ad7",
Expand All @@ -109,4 +109,4 @@
},
"timestamp": "2024-12-12T18:31:26.492075412"
}
}
}
2 changes: 1 addition & 1 deletion subworkflows/nf-neuro/preproc_dwi/tests/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ process {
ext.voxel_size = 1
ext.interp = "lin"
}
withName: "BETCROP_CROPVOLUME" {
withName: "IMAGE_CROPVOLUME" {
ext.output_bbox = false
}

Expand Down
20 changes: 10 additions & 10 deletions subworkflows/nf-neuro/preproc_t1/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ include { PREPROC_N4 } from '../../../modules/nf-neuro/preproc/n4/main'
include { IMAGE_RESAMPLE } from '../../../modules/nf-neuro/image/resample/main'
include { BETCROP_ANTSBET } from '../../../modules/nf-neuro/betcrop/antsbet/main'
include { BETCROP_SYNTHBET} from '../../../modules/nf-neuro/betcrop/synthbet/main'
include { BETCROP_CROPVOLUME as BETCROP_CROPVOLUME_T1 } from '../../../modules/nf-neuro/betcrop/cropvolume/main'
include { BETCROP_CROPVOLUME as BETCROP_CROPVOLUME_MASK } from '../../../modules/nf-neuro/betcrop/cropvolume/main'
include { IMAGE_CROPVOLUME as IMAGE_CROPVOLUME_T1 } from '../../../modules/nf-neuro/image/cropvolume/main'
include { IMAGE_CROPVOLUME as IMAGE_CROPVOLUME_MASK } from '../../../modules/nf-neuro/image/cropvolume/main'

params.run_synthbet = false

Expand Down Expand Up @@ -126,18 +126,18 @@ workflow PREPROC_T1 {
ch_crop = image_bet
.map{ it + [[]] }

BETCROP_CROPVOLUME_T1 ( ch_crop )
ch_versions = ch_versions.mix(BETCROP_CROPVOLUME_T1.out.versions.first())
image_crop = BETCROP_CROPVOLUME_T1.out.image
bbox = BETCROP_CROPVOLUME_T1.out.bounding_box
IMAGE_CROPVOLUME_T1 ( ch_crop )
ch_versions = ch_versions.mix(IMAGE_CROPVOLUME_T1.out.versions.first())
image_crop = IMAGE_CROPVOLUME_T1.out.image
bbox = IMAGE_CROPVOLUME_T1.out.bounding_box

// ** Crop mask ** //
ch_crop_mask = mask_bet
.join(BETCROP_CROPVOLUME_T1.out.bounding_box)
.join(IMAGE_CROPVOLUME_T1.out.bounding_box)

BETCROP_CROPVOLUME_MASK ( ch_crop_mask )
ch_versions = ch_versions.mix(BETCROP_CROPVOLUME_MASK.out.versions.first())
mask_crop = BETCROP_CROPVOLUME_MASK.out.image
IMAGE_CROPVOLUME_MASK ( ch_crop_mask )
ch_versions = ch_versions.mix(IMAGE_CROPVOLUME_MASK.out.versions.first())
mask_crop = IMAGE_CROPVOLUME_MASK.out.image
}
else{
image_crop = image_bet
Expand Down
2 changes: 1 addition & 1 deletion subworkflows/nf-neuro/preproc_t1/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ components:
- image/resample
- betcrop/antsbet
- betcrop/synthbet
- betcrop/cropvolume
- image/cropvolume

input:
- ch_image:
Expand Down
2 changes: 1 addition & 1 deletion subworkflows/nf-neuro/preproc_t1/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ nextflow_workflow {
tag "image/resample"
tag "betcrop/antsbet"
tag "betcrop/synthbet"
tag "betcrop/cropvolume"
tag "image/cropvolume"

tag "load_test_data"

Expand Down
Loading

0 comments on commit 38949cc

Please sign in to comment.