Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#45 - Change category cropvolume module (move to image) [WIP] #78

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 @@ -104,24 +104,24 @@ 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_CROPVOLUME_T1 ( ch_crop )
ch_versions = ch_versions.mix(IMAGE_CROPVOLUME_T1.out.versions.first())

// ** 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())
IMAGE_CROPVOLUME_MASK ( ch_crop_mask )
ch_versions = ch_versions.mix(IMAGE_CROPVOLUME_MASK.out.versions.first())

emit:
t1_final = BETCROP_CROPVOLUME_T1.out.image // channel: [ val(meta), t1-preprocessed ]
mask_final = BETCROP_CROPVOLUME_MASK.out.image // channel: [ val(meta), t1-mask ]
t1_final = IMAGE_CROPVOLUME_T1.out.image // channel: [ val(meta), t1-preprocessed ]
mask_final = IMAGE_CROPVOLUME_MASK.out.image // channel: [ val(meta), t1-mask ]
image_nlmeans = DENOISING_NLMEANS.out.image // channel: [ val(meta), t1-after-denoise ]
image_N4 = PREPROC_N4.out.image // channel: [ val(meta), t1-after-unbias ]
image_resample = IMAGE_RESAMPLE.out.image // channel: [ val(meta), t1-after-resample ]
image_bet = image_bet // channel: [ val(meta), t1-after-bet ]
mask_bet = mask_bet // channel: [ val(meta), intermediary-mask ]
crop_box = BETCROP_CROPVOLUME_T1.out.bounding_box // channel: [ val(meta), bounding-box ]
crop_box = IMAGE_CROPVOLUME_T1.out.bounding_box // channel: [ val(meta), bounding-box ]
versions = ch_versions // channel: [ versions.yml ]
}
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
2 changes: 1 addition & 1 deletion subworkflows/nf-neuro/preproc_t1/tests/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ process {
ext.voxel_size = 1
ext.interp = "lin"
}
withName: "BETCROP_CROPVOLUME_T1" {
withName: "IMAGE_CROPVOLUME_T1" {
ext.output_bbox = true
ext.first_suffix = "t1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ process {
ext.voxel_size = 1
ext.interp = "lin"
}
withName: "BETCROP_CROPVOLUME_T1" {
withName: "IMAGE_CROPVOLUME_T1" {
ext.output_bbox = true
ext.first_suffix = "t1"
}
Expand Down
Loading