-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from royerlab/dev
Dev
- Loading branch information
Showing
130 changed files
with
5,714 additions
and
315 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{% set name = "napari-chatgpt" %} | ||
{% set version = "2024.2.19" %} | ||
|
||
package: | ||
name: {{ name|lower }} | ||
version: {{ version }} | ||
|
||
source: | ||
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/napari-chatgpt-{{ version }}.tar.gz | ||
sha256: 4b7238d46766db40fff48735028ff17cd4229f1028a212646f381d459ab89625 | ||
|
||
build: | ||
noarch: python | ||
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation | ||
number: 0 | ||
|
||
requirements: | ||
host: | ||
- python >=3.9 | ||
- setuptools >=42.0.0 | ||
- wheel | ||
- setuptools-scm | ||
- pip | ||
run: | ||
- python >=3.9 | ||
- numpy | ||
- magicgui | ||
- scikit-image | ||
- qtpy | ||
- qtawesome | ||
- langchain ==0.1.5 | ||
- langchain-openai ==0.0.5 | ||
- openai | ||
- anthropic | ||
- fastapi | ||
- uvicorn | ||
- websockets | ||
- tiktoken | ||
- wikipedia | ||
- lxml | ||
- gtts | ||
- playsound | ||
- matplotlib-base | ||
- xarray | ||
- arbol | ||
- microsoft::playwright | ||
- duckduckgo-search | ||
- ome-zarr | ||
- transformers | ||
- cryptography | ||
- tabulate | ||
- numba | ||
- imageio | ||
- notebook | ||
- nbformat | ||
- jedi | ||
- black | ||
|
||
#test: | ||
# imports: | ||
# - napari_chatgpt | ||
# commands: | ||
# - pip check | ||
# requires: | ||
# - pip | ||
|
||
about: | ||
home: https://github.com/royerlab/napari-chatgpt | ||
summary: A napari plugin to process and analyse images with chatGPT. | ||
license: BSD-3-Clause | ||
license_file: LICENSE | ||
|
||
extra: | ||
recipe-maintainers: | ||
- royerloic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
from typing import Union | ||
|
||
from qtpy.QtCore import Qt, Signal | ||
from qtpy.QtGui import QIcon, QPixmap, QColor, QImage | ||
from qtpy.QtWidgets import QLabel | ||
|
||
|
||
class ClickableIcon(QLabel): | ||
clicked = Signal() # Signal to emit when the label is clicked | ||
|
||
def __init__( | ||
self, | ||
icon: Union[QIcon, QPixmap, str], | ||
size: int = 24, | ||
invert_colors: bool = True, | ||
parent=None | ||
): | ||
""" | ||
Create a clickable icon label. | ||
The icon can be: QIcon, QPixmap, or a string with the path to the image. | ||
For example: | ||
icon = QApplication.style().standardIcon(QStyle.SP_FileIcon) | ||
Parameters | ||
---------- | ||
icon : QIcon, QPixmap, or str | ||
The icon to display | ||
parent : QWidget, optional | ||
The parent widget, by default None | ||
""" | ||
super().__init__(parent) | ||
|
||
# Store the size for use in scaling the icon: | ||
self.size = size | ||
|
||
# Convert the icon to QIcon if it is a string: | ||
if isinstance(icon, str): | ||
icon = QIcon(icon) | ||
|
||
# Convert the icon to QPixmap if it is a QIcon or use it directly if it's already a QPixmap: | ||
if isinstance(icon, QIcon): | ||
# Get the pixmap from the icon, scaled isotropically: | ||
pixmap = icon.pixmap(self.size, self.size) | ||
elif isinstance(icon, QPixmap): | ||
pixmap = icon.scaled(self.size, | ||
self.size, | ||
Qt.KeepAspectRatio, | ||
Qt.SmoothTransformation) | ||
|
||
# Invert colors if requested: | ||
if invert_colors: | ||
pixmap = self._modify_pixmap_for_dark_ui(pixmap) | ||
|
||
# If the icon is a QPixmap, use it directly: | ||
self.setPixmap(pixmap) | ||
|
||
# Change cursor to hand pointer when hovering over the label: | ||
self.setCursor(Qt.PointingHandCursor) | ||
|
||
def mousePressEvent(self, event): | ||
if event.button() == Qt.LeftButton: | ||
self.clicked.emit() | ||
|
||
@staticmethod | ||
def _modify_pixmap_for_dark_ui(pixmap): | ||
# Convert QPixmap to QImage | ||
image = pixmap.toImage() | ||
|
||
# Ensure image supports alpha channel: | ||
image = image.convertToFormat(QImage.Format_ARGB32) | ||
|
||
# Access image pixels to invert colors and rotate hue, preserving transparency | ||
for x in range(image.width()): | ||
for y in range(image.height()): | ||
# Get the current pixel's color with alpha channel | ||
color = QColor(image.pixel(x, y)) | ||
|
||
# Invert colors | ||
color.setRed(255 - color.red()) | ||
color.setGreen(255 - color.green()) | ||
color.setBlue(255 - color.blue()) | ||
|
||
# # Rotate hue by 180 degrees | ||
# if ( | ||
# color.hue() != -1 | ||
# ): # Check if color is not grayscale (hue is undefined for grayscale) | ||
# hue = (color.hue() + 180) % 360 | ||
# color.setHsv( | ||
# hue, color.saturation(), color.value(), color.alpha() | ||
# ) # Preserve alpha | ||
# | ||
# # Set the modified color back to the image | ||
# image.setPixel( | ||
# x, y, color.rgba() | ||
# ) # Use rgba() to include the alpha channel | ||
|
||
# Convert QImage back to QPixmap | ||
modified_pixmap = QPixmap.fromImage(image) | ||
return modified_pixmap |
Oops, something went wrong.