Skip to content

Commit

Permalink
Merge pull request #17 from Steven-N-Hart/renaming_modules
Browse files Browse the repository at this point in the history
Renaming modules
  • Loading branch information
Steven-N-Hart authored Feb 11, 2021
2 parents 3657d25 + 75d7b4a commit 520a06f
Show file tree
Hide file tree
Showing 30 changed files with 54 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN cd dicom_wsi && pip3 install -r requirements.txt && cd /
ENV PYTHONPATH=$PYTHONPATH:/dicom_wsi/dicom_wsi/mods/
#
## Add other tools
##Google
## Google
#RUN wget https://github.com/GoogleCloudPlatform/wsi-to-dicom-converter/releases/download/v1.0.3/wsi2dcm_1.0.3.deb
#RUN apt install ./wsi2dcm_1.0.3.deb
#
Expand Down
20 changes: 20 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
__author__ = """Steven N. Hart"""
__email__ = '[email protected]'
__version__ = '1.0.0'
from .dicom_wsi import add_annotations
from .dicom_wsi import base_attributes
from .dicom_wsi import character_validations
from .dicom_wsi import cli
from .dicom_wsi import dicom_wsi
from .dicom_wsi import extract_annotations
from .dicom_wsi import extract_image_patches
from .dicom_wsi import image_filter
from .dicom_wsi import input_validation
from .dicom_wsi import mapping
from .dicom_wsi import parse_wsi
from .dicom_wsi import pixel_data_conversion
from .dicom_wsi import pixel_to_slide_conversions
from .dicom_wsi import run
from .dicom_wsi import sequence_attributes
from .dicom_wsi import shared_functional_groups
from .dicom_wsi import utils
3 changes: 2 additions & 1 deletion dicom_wsi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
"""Top-level package for dicom-wsi."""
__author__ = """Steven N. Hart"""
__email__ = '[email protected]'
__version__ = '0.1.0'
__version__ = '1.0.0'

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import tempfile

import pydicom
from pydicom.dataset import Dataset, FileDataset
from pydicom.dataset import FileMetaDataset, FileDataset

# noinspection PyUnresolvedReferences,PyUnresolvedReferences,PyUnresolvedReferences
# from mods.utils import add_data
from .utils import add_data


Expand Down Expand Up @@ -40,7 +39,8 @@ def build_base(cfg, instance=1):
suffix = '.' + str(instance) + '.dcm'
filename_little_endian = tempfile.NamedTemporaryFile(suffix=suffix).name

file_meta = Dataset()
# file_meta = Dataset() # deprecated in pydicom 3.0
file_meta = FileMetaDataset()

if compression_type == 'None':
# noinspection PyPep8,PyUnresolvedReferences
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion dicom_wsi/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import sys

from mods import parse_wsi
from . import parse_wsi
from yaml import load, BaseLoader

import dicom_wsi
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions dicom_wsi/dicom_wsi.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
import logging

from mods.input_validation import validate_cfg
from mods.run import run_instance
from .input_validation import validate_cfg
from .run import run_instance

logger = logging.getLogger(__name__)
import multiprocessing as mp
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file removed dicom_wsi/mods/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions docs/gettingstarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ To use dicom-wsi in a project:
.. code-block:: python
from yaml import load, BaseLoader
from dicom_wsi import create_dicom
from parse_wsi import get_wsi
import dicom_wsi
dwsi = dicom_wsi.dicom_wsi
get_wsi = dicom_wsi.parse_wsi.get_wsi
# Define your YAML file
my_yaml = '/path/to/yaml'
Expand All @@ -86,7 +87,7 @@ To use dicom-wsi in a project:
# Read the WSI, updating the config with information contained in the slide
cfg, wsi = get_wsi(cfg)
# Create DICOM files
create_dicom(cfg)
dwsi.create_dicom(cfg)
Sample RUN
Expand Down
12 changes: 10 additions & 2 deletions docs/tldr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
TL;DR
=====

To use dicom-wsi in a project:
To use dicom-wsi in a project, you can run in one of two ways. You can run the command line program,

.. code-block:: console
python cli.py cli.py -w <WSI File path> -o <OutputDirectory> -p <output file prefix> -y yaml/base.yaml
python cli.py -w <WSI File path> -o <OutputDirectory> -p <output file prefix> -y yaml/base.yaml
Or you can run it directly from python

.. code-block:: python
import dicom_wsi
dicom_wsi.dicom_wsi.create_dicom(cfg, pools=n_pools)
The `cfg` is the dictionary of required entities, and n_pools defines the number of threads to use.

That's it!
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
include_package_data=True,
keywords='dicom_wsi',
name='dicom_wsi',
packages=find_packages(include=['dicom_wsi', 'dicom_wsi.*']),
packages=find_packages(),
setup_requires=setup_requirements,
test_suite='tests',
tests_require=test_requirements,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_base_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from yaml import load, BaseLoader

from ..dicom_wsi.mods.base_attributes import build_base
from ..dicom_wsi.mods.parse_wsi import *
from ..dicom_wsi.base_attributes import build_base
from ..dicom_wsi.parse_wsi import get_wsi


def test_get_wsi():
Expand Down
6 changes: 1 addition & 5 deletions tests/test_character_validations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
# -*- coding: utf-8 -*-

"""Tests for `dicom_wsi` package."""
import os
import sys

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import pytest
from ..dicom_wsi import character_validations as cv

from ..dicom_wsi.mods import character_validations as cv

def test_cs():
cv.cs_validator('patient', 'Roberto')
Expand Down
22 changes: 0 additions & 22 deletions tests/test_dicom_wsi.py

This file was deleted.

6 changes: 3 additions & 3 deletions tests/test_sequence_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

from yaml import load, BaseLoader

from ..dicom_wsi.mods.base_attributes import build_base
from ..dicom_wsi.mods.parse_wsi import *
from ..dicom_wsi.mods.sequence_attributes import build_sequences
from ..dicom_wsi.base_attributes import build_base
from ..dicom_wsi.parse_wsi import get_wsi
from ..dicom_wsi.sequence_attributes import build_sequences


def test_get_wsi():
Expand Down
8 changes: 4 additions & 4 deletions tests/test_shared_functional_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

from yaml import load, BaseLoader

from ..dicom_wsi.mods.base_attributes import build_base
from ..dicom_wsi.mods.parse_wsi import *
from ..dicom_wsi.mods.sequence_attributes import build_sequences
from ..dicom_wsi.mods.shared_functional_groups import build_functional_groups
from ..dicom_wsi.base_attributes import build_base
from ..dicom_wsi.parse_wsi import get_wsi
from ..dicom_wsi.sequence_attributes import build_sequences
from ..dicom_wsi.shared_functional_groups import build_functional_groups


def test_get_wsi():
Expand Down

0 comments on commit 520a06f

Please sign in to comment.