Thank you for your interest in contributing to MOSAIC! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Pull Request Process
- Code Style Guidelines
- Testing
- Reporting Issues
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to sander.moonemans@gmail.com.
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/MOSAIC.git cd MOSAIC -
Add the upstream repository:
git remote add upstream https://github.com/SanderMoon/MOSAIC.git
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the package in development mode:
pip install -e ".[dev]" -
Install pre-commit hooks:
pre-commit install
-
Install additional dependencies:
pip install git+https://github.com/salaniz/pycocoevalcap.git
We welcome several types of contributions:
- Bug fixes: Fix identified issues in the codebase
- Feature additions: Add new functionality to the framework
- Documentation improvements: Enhance documentation, examples, or tutorials
- Performance optimizations: Improve code efficiency or speed
- Test coverage: Add or improve tests
- Check the issue tracker to see if your idea or bug report already exists
- For major changes, please open an issue first to discuss your proposed changes
- Make sure you have the latest version of the main branch
-
Create a branch: Create a new branch from
mainfor your changes:git checkout -b feature/your-feature-name
-
Make your changes: Implement your changes following the code style guidelines
-
Test your changes: Ensure all tests pass and add new tests if necessary:
pytest
-
Run code quality checks:
black . isort . flake8 . mypy src/
-
Commit your changes with a clear commit message:
git commit -m "Add feature: brief description of changes" -
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request: Open a pull request against the
mainbranch
- Clear description: Provide a clear description of what your PR does
- Reference issues: Link to any relevant issues using "Fixes #issue_number"
- Update documentation: Update relevant documentation if needed
- One feature per PR: Keep pull requests focused on a single feature or fix
- Follow PEP 8 style guidelines
- Use type hints for function signatures
- Write docstrings for public functions and classes
- Keep functions focused and relatively small
- Use meaningful variable and function names
def process_image_features(
features: torch.Tensor,
max_patches: int = 1000
) -> torch.Tensor:
"""
Process image features by selecting top patches.
Args:
features: Input tensor of shape [batch, patches, dim]
max_patches: Maximum number of patches to keep
Returns:
Processed features tensor
"""
if features.size(1) > max_patches:
features = features[:, :max_patches, :]
return featuresWhen reporting issues, please include:
- Clear title: Brief description of the issue
- Environment details: Python version, OS, relevant package versions
- Steps to reproduce: Detailed steps to reproduce the issue
- Expected behavior: What you expected to happen
- Actual behavior: What actually happened
- Code example: Minimal reproducible example if applicable
- Error messages: Full error messages and stack traces
Use the provided issue templates when available:
- Bug report
- Feature request
- Documentation improvement
-
Stay up to date: Regularly sync with upstream:
git fetch upstream git checkout main git merge upstream/main
-
Create feature branches from the latest main branch
-
Make small, focused commits with clear commit messages
-
Test thoroughly before submitting PRs
Contributors will be acknowledged in the project. Significant contributions may be recognized in the project documentation or release notes.
- Documentation: Check the docs/ directory
- Issues: Search existing issues or create a new one
- Email: Contact sander.moonemans@gmail.com for questions
By contributing to MOSAIC, you agree that your contributions will be licensed under the Apache License 2.0.
Thank you for contributing to MOSAIC! Your contributions help advance computational pathology research.