CoolFace
Datasetpublic

daniAdnan/liver-tumor-classification

Dataset Card for Liver Tumor Classification (from LiTS) Dataset Summary This dataset contains processed instances derived from the Liver Tumor Segmentation Challenge (LiTS) dataset, adapted for a binary liver tumor classification task. The original 3D CT scans and segmentation masks have been processed into individual 2D slices. Each data instance includes: sample: The original CT slice obtained directly from the 3D scan. w_sample: The windowed CT slice, processed from sample… See the full description on the dataset page: https://huggingface.co/datasets/daniAdnan/liver-tumor-classification.

sourceHugging Facecc-by-nc-sa-4.0updated 6mo agoView on Hugging Face
0likes20downloads
Dataset Card

Dataset Card for Liver Tumor Classification (from LiTS)

Dataset Description

  • —Paper (Original LiTS): The Liver Tumor Segmentation Benchmark (LiTS) (https://doi.org/10.1016/j.media.2022.102680).
  • —Contact: Seongun Kim, seongun@kaist.ac.kr

Dataset Summary

This dataset contains processed instances derived from the Liver Tumor Segmentation Challenge (LiTS) dataset, adapted for a binary liver tumor classification task. The original 3D CT scans and segmentation masks have been processed into individual 2D slices.

Each data instance includes:

  • —sample: The original CT slice obtained directly from the 3D scan.
  • —w_sample: The windowed CT slice, processed from sample to enhance contrast for features relevant to liver tumors. This is the actual input typically used for neural network training/inference.
  • —label: A binary label (Normal / Tumor present) assigned based on the segmentation mask.
  • —mask: The original segmentation mask corresponding to the slice.

Image data (sample, w_sample, mask) is stored as individual .png files, and the corresponding classification label (label) along with image paths are stored in a central metadata.jsonl file.

Example Instance (ID: 960)

Below is a visual example of the data provided for a single instance:

Original Slice (`sample`)Windowed Slice (`w_sample`)Segmentation Mask (`mask`)
[image][image][image]
images/sample/960.pngimages/w_sample/960.pngimages/mask/960.png

(Note: Mask values in the PNG are scaled for visualization: 0=Background, 127=Liver, 255=Tumor)


Dataset Structure

Data Organization

The dataset follows a structure optimized for use with the Hugging Face datasets library using image files and a metadata file:

  • —`metadata.jsonl`: A JSON Lines file where each line is a JSON object representing one data instance. Each object contains paths to the image files and the classification label.
  • —`images/`: A directory containing subdirectories for each image type.
  • —images/sample/: Contains the original CT slice images (e.g., 0.png, 1.png, ...).
  • —images/w_sample/: Contains the windowed CT slice images.
  • —images/mask/: Contains the segmentation mask images. Note: Mask images store pixel values scaled for visualization (0 for Background, 127 for Liver, 255 for Tumor).

Example `metadata.jsonl` entry:

json
{"sample_path": "images/sample/0.png", "w_sample_path": "images/w_sample/0.png", "mask_path": "images/mask/0.png", "label": 0}

Loading with `datasets` library:

python
from datasets import load_dataset, Features, Image, Value
import os

# Define features to help the library interpret the data
features = Features({
    'sample_path': Image(decode=True),  # Load as PIL Image
    'w_sample_path': Image(decode=True), # Load as PIL Image
    'mask_path': Image(decode=False), # Load mask path as string or raw PIL without decoding colors
    'label': Value(dtype='int64')    # Label is integer
})

# Load from Hugging Face Hub
dataset_dict = load_dataset("seongun/liver-tumor-classification", features=features)

# Or load from a local directory containing metadata.jsonl and images/
local_data_path = './data/LiverTumor' # Adjust path as needed
dataset_dict = load_dataset('json', data_files={'train': os.path.join(local_data_path, 'metadata.jsonl')}, features=features)

dataset = dataset_dict['train']
print(dataset[0])
# Example Output (values depend on feature definition):
# {'sample_path': <PIL.PngImagePlugin.PngImageFile image mode=L size=512x512>,
#  'w_sample_path': <PIL.PngImagePlugin.PngImageFile image mode=L size=512x512>,
#  'mask_path': <PIL.PngImagePlugin.PngImageFile image mode=L size=512x512>,
#  'label': 0}

Data Fields

Field NameDescriptionData Type (Loaded)Original Meaning / Notes
sample_pathPath to the original CT slice imagePIL.ImageGrayscale image (originally float64 [0,1], saved as uint8 [0,255])
w_sample_pathPath to the windowed CT slice imagePIL.ImageGrayscale image (originally float64 [0,1], saved as uint8 [0,255])
mask_pathPath to the segmentation mask imagePIL.Image or strGrayscale image. Saved values: 0, 127, 255. Original labels: 0, 1, 2.
labelBinary classification label for the sliceint640: Normal, 1: Tumor

Note on Masks: The mask PNG files store scaled values (0, 127, 255) for easier visualization. When loading these masks for training or evaluation, the pixel values need to be mapped back to the original class labels (0, 1, 2). The provided PyTorch LiverTumorDataset class handles this conversion.


Additional Information

Dataset Curators

Seongun Kim (KAIST)

Licensing Information

The original LiTS dataset is licensed under CC-BY-NC-SA-4.0. As this dataset is a derivative work, it is released under the same CC-BY-NC-SA-4.0 license. You must give appropriate credit to the original LiTS creators (see Citation section), provide a link to the license, and indicate if changes were made. If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. This dataset is intended for non-commercial research purposes.

License Deed: https://creativecommons.org/licenses/by-nc-sa/4.0/

Citation Information

If you use this dataset in your research, please consider citing the original LiTS publication and this dataset repository:

Original LiTS Publication:

bibtex
@article{bilic2023liver,
  title={The liver tumor segmentation benchmark (lits)},
  author={Bilic, Patrick and Christ, Patrick and Li, Hongwei Bran and Vorontsov, Eugene and Ben-Cohen, Avi and Kaissis, Georgios and Szeskin, Adi and Jacobs, Colin and Mamani, Gabriel Efrain Humpire and Chartrand, Gabriel and others},
  journal={Medical image analysis},
  volume={84},
  pages={102680},
  year={2023},
  publisher={Elsevier}
}

This Dataset Repository:

bibtex
@misc{seongun_liver_2025,
  author={Kim, Seongun},
  title={Liver Tumor Classification derived from LiTS},
  year={2025},
  publisher={Hugging Face},
  journal={Hugging Face Hub},
  howpublished = {\url{https://huggingface.co/datasets/seongun/liver-tumor-classification}}
}