neuronflow / BraTS-Toolkit

Code to preprocess, segment, and fuse glioma MRI scans based on the BraTS Toolkit manuscript.
https://www.frontiersin.org/articles/10.3389/fnins.2020.00125/full
GNU Affero General Public License v3.0
70 stars 11 forks source link

Running on Windows #13

Closed Gresliebear closed 2 years ago

Gresliebear commented 2 years ago

Is the source code private?

I am trying to use on Windows 10 got error


basename: Output_training
tempFold: C:\Users\lesli\AppData\Local\Temp\tmpp4dzwfok\Output_training
stopping docker with command: docker stop greedy_elephant
Error response from daemon: No such container: greedy_elephant
stopping docker with command: docker rm greedy_elephant
Error: No such container: greedy_elephant
docker pull projectelephant/server
Using default tag: latest
latest: Pulling from projectelephant/server
Digest: sha256:60e5e0ece0f794a6e853e83ab40f99b9e898445fec6ace6b8f596c973ad2ec7c
Status: Image is up to date for projectelephant/server:latest
docker.io/projectelephant/server:latest
exam_import_folder: C:\Users\lesli\AppData\Local\Temp\tmpp4dzwfok
dicom_import_folder: C:\Users\lesli\AppData\Local\Temp\tmpp4dzwfok
exam_export_folder: E:\Datasets\BraTS challenge\Output
nifti_export_folder: E:\Datasets\BraTS challenge\Output
backend_scripts\win_docker.cmd 3 C:\Users\lesli\AppData\Local\Temp\tmpp4dzwfok E:\Datasets\BraTS challenge\Output C:\Users\lesli\AppData\Local\Temp\tmpp4dzwfok E:\Datasets\BraTS challenge\Output 0
E:\BraTS Challenge\vessel_env\src\brats-toolkit\brats_toolkit\util
starting docker!
Traceback (most recent call last):
  File "E:\BraTS Challenge\RedTinSaintBernard-for-BraTS2021-challenge\single_preprocessing.py", line 48, in <module>
    prep.single_preprocess(t1File=t1File,
  File "e:\brats challenge\vessel_env\src\brats-toolkit\brats_toolkit\preprocessor.py", line 106, in single_preprocess
    self.batch_preprocess(exam_import_folder=dockerFolder, exam_export_folder=dockerOutputFolder, mode=mode,
  File "e:\brats challenge\vessel_env\src\brats-toolkit\brats_toolkit\preprocessor.py", line 121, in batch_preprocess
    start_docker(exam_import_folder=exam_import_folder, exam_export_folder=exam_export_folder,
  File "e:\brats challenge\vessel_env\src\brats-toolkit\brats_toolkit\util\docker_functions.py", line 63, in start_docker
    subprocess.run(command, cwd=cwd)
  File "C:\Python39\lib\subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified```
neuronflow commented 2 years ago

no source code is public, please feel welcomed to read the manual.

can you please specify what you are trying to do and how?

Gresliebear commented 2 years ago

ya, I found the link at the bottom, my bad. Anyways I am trying to do preprocessing on the 2020 Brats dataset because I want to try attempting the challenge for 2021 this year. I am running the Brats toolkit on windows 10 but I have read in all the data so I build a for loop to process it all at once.

import os
import pandas as pd
from brats_toolkit.preprocessor import Preprocessor
# instantiate
prep = Preprocessor()

## convert mapping info
## survial 
name_mapping = r"E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\name_mapping.csv"
survival_info = r"E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\survival_info.csv"

df_name_mapping = pd.read_csv(name_mapping)
df_survival_info = pd.read_csv(survival_info)

root_path_train = r"E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData"
outputDir = r"E:\Datasets\BraTS challenge\Output\Output_training"
list_of_dir = os.listdir(root_path_train)

for name_of_file in list_of_dir:

    #if name_of_file contains .csv it skips iteration on the loop
    if name_of_file.endswith('.csv'):
        continue

    #We make new path tto list to for loop through we list that dir
    readable_path = os.path.join(root_path_train , name_of_file)
    list_of_zips = os.listdir(readable_path)

    # we for loop each folder
    list_sort = []
    outpath = os.path.join(outputDir, name_of_file)

    for zips in list_of_zips:

        readable_path_2nd = os.path.join(readable_path, zips)
        list_sort.append(readable_path_2nd)
        list_sort = sorted(list_sort)
        ## missing var for segmentation preprocessing # E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\BraTS20_Training_369\BraTS20_Training_369_seg.nii.gz 2 ??

    examName = name_of_file
    flaFile = list_sort[0] #  E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\BraTS20_Training_369\BraTS20_Training_369_flair.nii.gz1 flaFile
    t1File = list_sort[2] # E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\BraTS20_Training_369\BraTS20_Training_369_t1.nii.gz 3 t1File
    t1cFile = list_sort[3] # E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\BraTS20_Training_369\BraTS20_Training_369_t1ce.nii.gz 4 t1cFile
    t2File = list_sort[4] # E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\BraTS20_Training_369\BraTS20_Training_369_t2.nii.gz 5 t2File

    ## this code calls docker!
    ##dcm2niix conversion 
    prep.single_preprocess(t1File=t1File, 
        t1cFile=t1cFile, 
        t2File=t2File, 
        flaFile=flaFile,
        outputFolder=outputDir, 
        mode="cpu", 
        confirm=True, 
        skipUpdate=False, 
        gpuid='0')

so your preprocessing object from your tool kit is called at bottom to process each patient file basically. I notice it calls a docker object pull but I really don't know whats wrong with the code at this point I need to more reading into source code or check the variables I am passing to your object.

neuronflow commented 2 years ago

Hmm the Brats 2020 data is already preprocessed and skullstripped? There is no need to do it again? Can you elaborate please?

On Fri, 9 Jul 2021, 21:47 Leslie Wubbel, @.***> wrote:

ya, I found the link at the bottom, my bad. Anyways I am trying to do preprocessing on the 2020 Brats dataset because I want to try attempting the challenge for 2021 this year. I am running the Brats toolkit on windows 10 but I have read in all the data so I build a for loop to process it all at once.

import os import pandas as pd from brats_toolkit.preprocessor import Preprocessor

instantiate

prep = Preprocessor()

convert mapping info

survial

name_mapping = r"E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\name_mapping.csv" survival_info = r"E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\survival_info.csv"

df_name_mapping = pd.read_csv(name_mapping) df_survival_info = pd.read_csv(survival_info)

root_path_train = r"E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData" outputDir = r"E:\Datasets\BraTS challenge\Output\Output_training" list_of_dir = os.listdir(root_path_train)

for name_of_file in list_of_dir:

#if name_of_file contains .csv it skips iteration on the loop
if name_of_file.endswith('.csv'):
    continue

#We make new path tto list to for loop through we list that dir
readable_path = os.path.join(root_path_train , name_of_file)
list_of_zips = os.listdir(readable_path)

# we for loop each folder
list_sort = []
outpath = os.path.join(outputDir, name_of_file)

for zips in list_of_zips:

    readable_path_2nd = os.path.join(readable_path, zips)
    list_sort.append(readable_path_2nd)
    list_sort = sorted(list_sort)
    ## missing var for segmentation preprocessing # E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\BraTS20_Training_369\BraTS20_Training_369_seg.nii.gz 2 ??

examName = name_of_file
flaFile = list_sort[0] #  E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\BraTS20_Training_369\BraTS20_Training_369_flair.nii.gz1 flaFile
t1File = list_sort[2] # E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\BraTS20_Training_369\BraTS20_Training_369_t1.nii.gz 3 t1File
t1cFile = list_sort[3] # E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\BraTS20_Training_369\BraTS20_Training_369_t1ce.nii.gz 4 t1cFile
t2File = list_sort[4] # E:\Datasets\BraTS challenge\MICCAI_BraTS2020_TrainingData\BraTS20_Training_369\BraTS20_Training_369_t2.nii.gz 5 t2File

## this code calls docker!
##dcm2niix conversion
prep.single_preprocess(t1File=t1File,
    t1cFile=t1cFile,
    t2File=t2File,
    flaFile=flaFile,
    outputFolder=outputDir,
    mode="cpu",
    confirm=True,
    skipUpdate=False,
    gpuid='0')

so your preprocessing object from your tool kit is called at bottom to process each patient file basically. I notice it calls a docker object pull but I really don't know whats wrong with the code at this point I need to more reading into source code or check the variables I am passing to your object.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/neuronflow/BraTS-Toolkit/issues/13#issuecomment-877418233, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVY46SV5UYKVESLI3KF45TTW5G3NANCNFSM477LIDHQ .

Gresliebear commented 2 years ago

like preprocessing data for a model like a deep learning model, you need to preprocess your data sometimes its for pngs, nitfti files, but are you saying that this specific toolkit was used to create the dataset?

neuronflow commented 2 years ago

No the Brats 2020 data was mostly created by a pipeline from UPenn with a slightly different skullstripper but the outputs are almost identical. We might have a future update incorporating the UPenn pipeline. I encourage you to read the btk paper to develop a better understanding of the three btk modules.

On Fri, 9 Jul 2021, 21:53 Leslie Wubbel, @.***> wrote:

like preprocessing data for a model like a deep learning model, you need to preprocess your data sometimes its for pngs, nitfti files, but are you saying that this specific toolkit was used to create the dataset?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/neuronflow/BraTS-Toolkit/issues/13#issuecomment-877421474, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVY46X725WLBSNVIB6UKFTTW5HUHANCNFSM477LIDHQ .

Gresliebear commented 2 years ago

ok so your saying that the dataset doesn't need any type of preprocessing? that the BraTS toolkit doesn't already provides? I will do more reading but btk modules? btk papers, I am sorry what resources are you talking about I haven't found these yet.

I will write my own preprocessing methods for our model but I am not trying to reinvent the wheel or deviate from common methods agreed upon by research, does that make sense?

neuronflow commented 2 years ago

https://github.com/neuronflow/BraTS-Toolkit#citation

Btk preprocessor can help you to preprocess Mr data so it can be segmented using BraTS algorithms.

On Fri, 9 Jul 2021, 22:02 Leslie Wubbel, @.***> wrote:

ok so your saying that the dataset doesn't need any type of preprocessing? that the BraTS toolkit doesn't already provides? I will do more reading but btk modules? btk papers, I am sorry what resources are you talking about I haven't found these yet.

I will write my own preprocessing methods for our model but I am not trying to reinvent the wheel or deviate from common methods agreed upon by research, does that make sense?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/neuronflow/BraTS-Toolkit/issues/13#issuecomment-877425735, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVY46XJJA2QL6PNIDIVJR3TW5IVJANCNFSM477LIDHQ .

Gresliebear commented 2 years ago

ok I guess that makes sense? still confused I will continue trying anyways, Thank you for the help.