INSTALL.md

December 20, 2024 · View on GitHub

⚙️ Requirements

Create a virtual environment using the following command:

conda create -n TextoMorph python=3.8
source activate TextoMorph # or conda activate TextoMorph
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
pip install -r requirements.txt

📂 Dataset Download Instructions

This document provides step-by-step instructions to download and prepare datasets required for the project.

📥 Download Unhealthy Data

Run the following commands to download and extract unhealthy datasets:

wget https://huggingface.co/datasets/qicq1c/Pubilcdataset/resolve/main/10_Decathlon/Task03_Liver.tar.gz # Task03_Liver.tar.gz (28.7 GB)
wget https://huggingface.co/datasets/qicq1c/Pubilcdataset/resolve/main/10_Decathlon/Task07_Pancreas.tar.gz # Task07_Pancreas.tar.gz (28.7 GB)
wget https://huggingface.co/datasets/qicq1c/Pubilcdataset/resolve/main/05_KiTS.tar.gz # KiTS.tar.gz (28 GB)

Extract the downloaded files:

tar -zxvf Task03_Liver.tar.gz
tar -zxvf Task07_Pancreas.tar.gz
tar -zxvf 05_KiTS.tar.gz

📥 Download Healthy Data

Download AbdonmenAtlas 1.0 using the following commands:

huggingface-cli BodyMaps/_AbdomenAtlas1.1Mini --token paste_your_token_here --repo-type dataset --local-dir .
bash unzip.sh
bash delete.sh

Download and prepare the HealthyCT dataset:

huggingface-cli download qicq1c/HealthyCT  --repo-type dataset --local-dir .  --cache-dir ./cache
cat healthy_ct.zip* > HealthyCT.zip
rm -rf healthy_ct.zip* cache
unzip -o -q HealthyCT.zip -d /HealthyCT

🛠️ Using the Singularity Container for TextoMorph

We provide a Singularity container for running TextoMorph tasks, which supports both text-driven tumor synthesis and segmentation (organ, tumor). Follow the instructions below to get started.

1️⃣ Text-Driven Tumor Synthesis

To generate tumors based on textual descriptions, use the following command:

inputs_data=/path/to/your/healthyCT
inputs_label=liver          # Example: pancreas, kidney
text="The liver contains arterial enhancement and washout."
outputs_data=/path/to/your/output/Text-Driven-Tumor

SINGULARITYENV_CUDA_VISIBLE_DEVICES=0 singularity run --nv -B $inputs_data:/workspace/inputs -B $outputs_data:/workspace/outputs textomerph.sif

1️⃣ Segmentation (Organ, Tumor) To perform organ or tumor segmentation on CT scans, use the following command:


inputs_data=/path/to/your/CT/scan/folders
outputs_data=/path/to/your/output/folders

SINGULARITYENV_CUDA_VISIBLE_DEVICES=0 singularity run --nv -B $inputs_data:/workspace/inputs -B $outputs_data:/workspace/outputs textomerph.sif