semvec/pypi-packages huggingface dataset:
pytorchradiomics 0.0.5
PyTorch implementation of PyRadiomics Extractor
Requires Python: >=3.10
Keywords: radiomics, cancerimaging, medicalresearch, computationalimaging

# PyTorchRadiomics

PyTorch implementation of [PyRadiomics](https://github.com/AIM-Harvard/pyradiomics) Extractor

# Performance Improvement

It can speed up voxel-based features extraction significantly, especially GLCM features.

Using it to extract non-voxel-based features is *NOT* recommended (it is slower).

## Voxel-based Features Extraction Performance Comparison
Intel i9-10900K v.s. RTX 3080 10G (dtype=torch.float64), Size=$16^3$

|Type|CPU Time|Torch Time|Max Abs. Error|Max Rel. Error|
|-|-|-|-|-|
GLCM|636s|23.8s|2.32e-09|7.92e-12|
FirstOrder|4.3s|0.244s|2.84e-14|2.22e-16|
GLRLM|1.71s|0.731s|2.72e-12|8.88e-16|
NGTDM|4.03s|0.398s|3.27e-11|3.99e-15|

# Installation
```
pip install pytorchradiomics
```

# Usage

Only two extra keyword arguments:
1. `device`: `str` or `torch.device`, default: `"cuda"`
2. `dtype`: `torch.dtype`, default: `torch.float64`

Direct usage:
```python
from torchradiomics import (TorchRadiomicsFirstOrder, TorchRadiomicsGLCM,
                            TorchRadiomicsGLRLM, TorchRadiomicsNGTDM,
                            inject_torch_radiomics, restore_radiomics)

ext = TorchRadiomicsGLCM(
    img_norm, mask_norm,
    voxelBased=True, padDistance=kernel,
    kernelRadius=kernel, maskedKernel=False, voxelBatch=512,
    dtype=torch.float64, # it is default
    device="cuda:0",
    **get_default_settings())

features = ext.execute()
```

Or use injection to use `RadiomicsFeatureExtractor`:

```python
from radiomics.featureextractor import RadiomicsFeatureExtractor
from torchradiomics import (TorchRadiomicsFirstOrder, TorchRadiomicsGLCM,
                            TorchRadiomicsGLRLM, TorchRadiomicsNGTDM,
                            inject_torch_radiomics, restore_radiomics)

inject_torch_radiomics() # replace cpu version with torch version

ext = RadiomicsFeatureExtractor(
    voxelBased=True, padDistance=kernel,
    kernelRadius=kernel, maskedKernel=False, voxelBatch=512,
    dtype=torch.float64, # it is default
    device="cuda:0",
    **get_default_settings())
ext.execute(img, mask, voxelBased=True)

restore_radiomics() # restore
```
Flask-Obfuscate 0.3
A Flask extension to obfuscate HTML responses.

# Flask-Obfuscate

Flask-Obfuscate is a Flask extension that obfuscates HTML responses to help protect your HTML content from easy inspection or copying. This extension processes all HTML responses and converts them into obfuscated JavaScript that writes the HTML content when executed in a browser.

## Features

- Obfuscates HTML responses by converting them to JavaScript
- Easy to integrate into existing Flask applications
- Simple usage with minimal configuration

## Installation

You can install Flask-Obfuscate via pip:

```sh
pip install Flask-Obfuscate
```

## Usage

### Basic Usage

Integrate Flask-Obfuscate into your Flask application with minimal setup:

```python
from flask import Flask
from flask_obfuscate import Obfuscate

app = Flask(__name__)
obfuscate = Obfuscate(app)

@app.route('/')
def index():
    return '<div>Hello, World!</div>'

if __name__ == '__main__':
    app.run(debug=True)
```

### Advanced Usage

You can also initialize Flask-Obfuscate later using the `init_app` method:

```python
from flask import Flask
from flask_obfuscate import Obfuscate

app = Flask(__name__)
obfuscate = Obfuscate()
obfuscate.init_app(app)

@app.route('/')
def index():
    return '<div>Hello, World!</div>'

if __name__ == '__main__':
    app.run(debug=True)
```

## Running Tests

To run the tests, first install the test dependencies:

```sh
pip install pytest
```

Then you can run the tests using pytest:

```sh
pytest tests
```

## Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss improvements or fixes.

1. Fork the repository.
2. Create a new branch: `git checkout -b my-feature-branch`
3. Make your changes and commit them: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-feature-branch`
5. Submit a pull request.

## License

This project is licensed under the MIT License.

## Acknowledgments

Inspired by the need to protect HTML content in Flask applications.