This directory contains various examples showcasing MarkinJS's capabilities for different use cases.
Complete interactive demo showcasing all MarkinJS features:
- All annotation types (bounding boxes, polygons, keypoints)
- Real-time event logging and coordinate tracking
- API demonstrations and code examples
- Interactive controls and configuration options
Perfect for: Getting started, exploring all features, API reference
Comprehensive API reference with examples:
- Method documentation
- Event system details
- Configuration options
- Integration examples
Perfect for: Development reference, API exploration
- Choose an example based on your use case
- Open the HTML file in your browser
- Start annotating - click, drag, and interact with the tools
- Export your data using the built-in export functions
examples/
├── index.html # Interactive demo with all features
├── api.html # API documentation and examples
├── assets/ # Shared resources
│ ├── css/ # Stylesheets
│ ├── images/ # Sample images
│ └── js/ # Third-party libraries
└── README.md # This file
Simply open any .html file in your web browser.
For better performance and to avoid CORS issues:
# Using Python
python -m http.server 8000
# Using Node.js
npx serve .
# Using PHP
php -S localhost:8000Then visit http://localhost:8000/examples/
All examples are self-contained and can be easily customized:
- Modify the HTML to change layout and controls
- Update the JavaScript to add new features or change behavior
- Adjust the CSS for different styling
- Change the image by replacing files in
assets/images/
- Start with Interactive Demo
- Modify classes to match your dataset categories
- Adapt export format for your ML framework
- Use Interactive Demo as foundation
- Add medical-specific annotation types (measurements, regions)
- Implement DICOM coordinate handling
- Begin with Interactive Demo
- Customize interface for your workflow
- Add project-specific export formats
import { useEffect, useRef } from 'react';
function AnnotationComponent({ imageUrl, onAnnotationChange }) {
const imageRef = useRef();
const annotatorRef = useRef();
useEffect(() => {
if (window.MarkinJS && imageRef.current) {
annotatorRef.current = MarkinJS.createImageAnnotator(imageRef.current.id, {
keyboardControls: true
});
annotatorRef.current.on('annotationcreated', onAnnotationChange);
}
}, []);
return <img ref={imageRef} id="annotation-target" src={imageUrl} />;
}<template>
<img ref="imageEl" :src="imageUrl" @load="initAnnotator" />
</template>
<script>
export default {
props: ['imageUrl'],
methods: {
initAnnotator() {
this.annotator = MarkinJS.createImageAnnotator(this.$refs.imageEl.id, {
keyboardControls: true
});
}
}
}
</script>Have a great use case or example to share? We'd love to include it!
- Create your example following the existing structure
- Add documentation explaining the use case
- Submit a pull request with your addition
- 📧 Questions: markinjs@datamarkin.com
- 🐛 Issues: GitHub Issues
- 📖 Documentation: Main Docs
All examples are released under the MIT License, same as MarkinJS.