Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b3f704b
Merge pull request #498 from jungmannlab/development
rafalkowalewski1 Sep 19, 2024
3039916
Merge pull request #500 from jungmannlab/development
rafalkowalewski1 Sep 19, 2024
14ce66c
Merge pull request #503 from jungmannlab/development
rafalkowalewski1 Oct 3, 2024
622e41f
proposal for GUI improvements
phcarl Oct 15, 2024
1b5814b
Update zfit.py
phcarl Jan 2, 2025
d1800b7
Update __main__.py
phcarl Jan 2, 2025
8f7e5ba
Update __main__.py
phcarl Jan 2, 2025
565b4fb
Update gausslq.py
phcarl Jan 2, 2025
294f62d
Update localize.py
phcarl Jan 2, 2025
0b1ddff
RESI dialog FIX, units in nm
rafalkowalewski1 Oct 15, 2024
333d8bb
display the last loaded file in Render after closing a channel
rafalkowalewski1 Oct 15, 2024
32bb0a5
CLEAN; FIX - saved picked locs metadata total area for circular pick
rafalkowalewski1 Dec 6, 2024
bd3f192
CMD localize saves camera information in the metadata file
rafalkowalewski1 Dec 6, 2024
05b28c2
Render show drift in nm
rafalkowalewski1 Dec 6, 2024
5004931
Picasso: Render - masking localizations saves the mask area in metadata
rafalkowalewski1 Dec 6, 2024
3f2c4ee
AIM undrifting and applying drift from txt yield the same result
rafalkowalewski1 Dec 8, 2024
9686201
Test clusterer keyboard tracking
rafalkowalewski1 Dec 8, 2024
fea65c1
Change function inputs for render gui's (h)dbscan to match the patter…
rafalkowalewski1 Dec 8, 2024
9dfc0d0
AIM from CMD, remove --mode from CMD undrift
rafalkowalewski1 Dec 8, 2024
b85fe94
Render: scale bar is automatically adjusted based on the current FOV'…
rafalkowalewski1 Dec 9, 2024
ea0ff53
export channels in grayscale
rafalkowalewski1 Dec 14, 2024
9ea8ca0
FIX automatic scale bar
rafalkowalewski1 Dec 14, 2024
8edfacb
Rotation window screenshot saves metadata and extra view with scale bar
rafalkowalewski1 Dec 14, 2024
0c6b4d4
automatic scalebar length adjustment for rotation window
rafalkowalewski1 Dec 14, 2024
1f7884e
CLEAN
rafalkowalewski1 Dec 14, 2024
053b347
Bump version: 0.7.3 → 0.7.4
rafalkowalewski1 Dec 14, 2024
88c6ccb
one click installer correct python version for pyinstaller compatibility
rafalkowalewski1 Dec 15, 2024
7e39d79
update plugin documentation
rafalkowalewski1 Jan 22, 2025
543a849
Filter histogram bug fix - when IQR is zero, error was displayed
rafalkowalewski1 Jan 22, 2025
0483bb2
add (h)dbscan references to the main page
rafalkowalewski1 Feb 5, 2025
018d546
counting polygonal picks FIX
rafalkowalewski1 Feb 6, 2025
e491b1d
AIM docstrings and error message CLEAN
rafalkowalewski1 Feb 6, 2025
d37dbd3
AIM on locs with frame filtered FIX
rafalkowalewski1 Feb 6, 2025
c46a29d
correct changelog
rafalkowalewski1 Feb 6, 2025
aa1ddfc
2D drift plot inverts y axis to match the rendered locs
rafalkowalewski1 Feb 6, 2025
597a314
3d animation fix
rafalkowalewski1 Feb 6, 2025
078e7d9
pick fiducials ADD
rafalkowalewski1 Feb 6, 2025
e1bdbaa
move undrift from picked to picasso.postprocess (formerly in picasso.…
rafalkowalewski1 Feb 6, 2025
4f21c90
Bump version: 0.7.4 → 0.7.5
rafalkowalewski1 Feb 6, 2025
44a800e
CLEAN
rafalkowalewski1 Feb 6, 2025
515a409
proposal for GUI improvements
Feb 14, 2025
3718410
Update __main__.py
phcarl Jan 2, 2025
c51fe47
Update __main__.py
phcarl Jan 2, 2025
f18b8d1
resolve conflict
Feb 14, 2025
973ce32
Update rotation.py
phcarl Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.3
current_version = 0.7.5
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
Expand Down
23 changes: 21 additions & 2 deletions changelog.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
Changelog
=========

Last change: 02-OCT-2024 MTS
Last change: 06-FEB-2025 MTS

0.7.1 - 0.7.3
0.7.5
-----
- Automatic picking of fiducials added in Render: ``Tools/Pick fiducials``
- Undrifting from picked moved from ``picasso/gui/render`` to ``picasso/postprocess``
- Plugin docs update
- Filter histogram display fixed for datasets with low variance (bug fix)
- AIM undrifting works now if the first frames of localizations are filtered out (bug fix)
- 2D drift plot in Render inverts y axis to match the rendered localizations
- 3D animation fixed
- Other minor bug fixes

0.7.1 - 0.7.4
-------------
- SMLM clusterer in picked regions deleted
- Show legend in Render property displayed rounded tick label values
- Pick circular area does not save the area for each pick in localization's metadata
- Picasso: Render - adjust the scale bar's size automatically based on the current FOV's width
- Picasso: Render - RESI dialog fixed, units in nm
- Picasso: Render - show drift in nm, not camera pixels
- Picasso: Render - masking localizations saves the mask area in its metadata
- Picasso: Render - export current view across channels in grayscale
- Picasso: Render - title bar displays the file only the names of the currently opened files
- CMD implementation of AIM undrifting, see ``picasso aim -h`` in terminal
- CMD localize saves camera information in the metadata file
- Other minor bug fixes

0.7.0
Expand Down
4 changes: 2 additions & 2 deletions distribution/picasso.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
AppName=Picasso
AppPublisher=Jungmann Lab, Max Planck Institute of Biochemistry

AppVersion=0.7.3
AppVersion=0.7.5
DefaultDirName={commonpf}\Picasso
DefaultGroupName=Picasso
OutputBaseFilename="Picasso-Windows-64bit-0.7.3"
OutputBaseFilename="Picasso-Windows-64bit-0.7.5"
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64

Expand Down
4 changes: 4 additions & 0 deletions docs/cmd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ undrift
-------
Correct localization coordinates for drift with RCC.

aim
-------
Correct localization coordinates for drift with AIM.

density
-------
Compute the local density of localizations
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = ""
# The full version, including alpha/beta/rc tags
release = "0.7.3"
release = "0.7.5"

# -- General configuration ---------------------------------------------------

Expand Down
19 changes: 9 additions & 10 deletions docs/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,33 @@ Plugins

Usage
-----
Starting in version 0.5.0, Picasso allows for creating plugins. They can be added by the user for each of the available distributions of picasso (GitHub, picassosr from PyPI and the one click installer). However, using plugins in the latter may cause issues, see below.
Starting in version 0.5.0, Picasso supports plugins. Please find the instructions on how to add them to your Picasso below.

Please keep in mind that the ``__init__.py`` file in the ``plugins`` folder must not be modified or deleted.
Please keep in mind that the ``__init__.py`` file in the ``picasso/picasso/gui/plugins`` folder must not be modified or deleted.

GitHub
~~~~~~
If you cloned the GitHub repository, you can add plugins by following these steps:
- Find the directory where you cloned the GitHub repository with Picasso.
- Go to ``picasso/picasso/gui/plugins``.
- Copy the plugin(s) to this folder.
- The plugin(s) should automatically work after running picasso in the new command window.

PyPI
~~~~
- Find the location of the environment where picassosr is installed (type ``conda env list`` to see the directory).
- Find this directory and go to ``YOUR_ENVIRONMENT/Lib/site-packages/picasso/gui/plugins``.
If you installed Picasso using ``pip install picassosr``, you can add plugins by following these steps:
- To find the location of the environment where ``picassosr`` is installed, type ``conda env list``.
- If your environment can be found under ``YOUR_ENVIRONMENT``, go to ``YOUR_ENVIRONMENT/Lib/site-packages/picasso/gui/plugins``.
- Copy the plugin(s) to this folder.
- The plugin(s) should automatically work after running picasso in the new command window.

One click installer
~~~~~~~~~~~~~~~~~~~
**NOTE**: This may lead to issues if Picasso is installed, as the plugin scripts will remain in the ``plugins`` folder upon deinstallation. After deinstalltion, the ``Picasso`` folder needs to be deleted manually.
**NOTE**: After deinstalling Picasso, ``Program Files/Picasso`` folder needs to be deleted manually, as the uninstaller currently does not remove the plugins automatically.

- Find the location where you installed Picasso. By default, it is ``C:/Program Files/Picasso``.
- Go to the following subfolder in the `Picasso` directory: ``picasso/gui/plugins``.
- Copy the plugin(s) to this folder.
- The plugin(s) should automatically be loaded after double-clicking the respective desktop shortcuts.

**NOTE**: Plugins added in this distribution will not be able to use packages that are not installed automatically (from the file ``requirements.txt``).
.. **NOTE**: Plugins added in this distribution will not be able to use packages that are not installed automatically (from the file ``requirements.txt``).

For developers
--------------
Expand All @@ -41,4 +40,4 @@ To create a plugin, you can use the template provided in ``picasso/plugin_templa
:scale: 70 %
:alt: Plugins

As an example, please see any of the plugins on the GitHub `repo <https://github.com/rafalkowalewski1/picasso_plugins>`_.
As an example, please see any of the plugins in the `GitHub repo <https://github.com/rafalkowalewski1/picasso_plugins>`_.
2 changes: 2 additions & 0 deletions docs/render.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ The 3D rotation window allows the user to render 3D localization data. To use it

The user may perform multiple actions in the rotation window, including: saving rotated localizations, building animations (.mp4 format), rotating by a specified angle, etc.

Note that to build animations, the user must have ``ffmpeg`` installed on their system.

Rotation around z-axis is available by pressing Ctrl/Command. Rotation axis can be frozen by pressing x/y/z to freeze around the corresponding axes (to freeze around the z-axis, Ctrl/Command must be pressed as well).

There are several things to keep in mind when using the rotation window. Firstly, using individual localization precision is very slow and is not recommended as a default blur method. Also, the size of the rotation window can be altered, however, if it becomes too large, rendering may start to lag.
Expand Down
2 changes: 1 addition & 1 deletion picasso/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os.path as _ospath
import yaml as _yaml

__version__ = "0.7.3"
__version__ = "0.7.5"

_this_file = _ospath.abspath(__file__)
_this_dir = _ospath.dirname(_this_file)
Expand Down
81 changes: 73 additions & 8 deletions picasso/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,26 @@ def _undrift(files, segmentation, display=True, fromfile=None):
savetxt(base + "_drift.txt", drift, header="dx\tdy", newline="\r\n")


def _undrift_aim(
files, segmentation, intersectdist=20/130, roiradius=60/130
):
import glob
from . import io, aim
from numpy import savetxt

paths = glob.glob(files)
for path in paths:
try:
locs, info = io.load_locs(path)
except io.NoMetadataFileError:
continue
print("Undrifting file {}".format(path))
locs, new_info, drift = aim.aim(locs, info, segmentation, intersectdist, roiradius)
base, ext = os.path.splitext(path)
io.save_locs(base + "_aim.hdf5", locs, new_info)
savetxt(base + "_aimdrift.txt", drift, header="dx\tdy", newline="\r\n")


def _density(files, radius):
import glob

Expand Down Expand Up @@ -772,7 +792,7 @@ def _localize(args):
print("Localize - Parameters:")
print("{:<8} {:<15} {:<10}".format("No", "Label", "Value"))

if args.fit_method == "lq-gpu":
if args.fit_method == "lq-gpu" or args.fit_method == "lq-gpu-3d":
if gausslq.gpufit_installed:
print("GPUfit installed")
else:
Expand Down Expand Up @@ -985,6 +1005,7 @@ def prompt_info():
print("------------------------------------------")

info.append(localize_info)
info.append(camera_info)

base, ext = splitext(path)

Expand All @@ -1004,7 +1025,7 @@ def prompt_info():

if CHECK_DB:
print("\n")
print("Assesing quality and adding to DB")
print("Assessing quality and adding to DB")
add_file_to_db(path, out_path)
print("Done.")
print("\n")
Expand Down Expand Up @@ -1210,12 +1231,12 @@ def main():
" specified by a unix style path pattern"
),
)
undrift_parser.add_argument(
"-m",
"--mode",
default="render",
help='"std", "render" or "framepair")',
)
# undrift_parser.add_argument(
# "-m",
# "--mode",
# default="render",
# help='"std", "render" or "framepair")',
# )
undrift_parser.add_argument(
"-s",
"--segmentation",
Expand All @@ -1239,6 +1260,48 @@ def main():
help="do not display estimated drift",
)

# undrift by AIM parser
undrift_aim_parser = subparsers.add_parser(
"aim", help="correct localization coordinates for drift with AIM"
)
undrift_aim_parser.add_argument(
"files",
help=(
"one or multiple hdf5 localization files"
" specified by a unix style path pattern"
),
)
undrift_aim_parser.add_argument(
"-s",
"--segmentation",
type=float,
default=100,
help=(
"the number of frames to be combined"
" for one temporal segment (default=100)"
),
)
undrift_aim_parser.add_argument(
"-i",
"--intersectdist",
type=float,
default=20/130,
help=(
"max. distance (cam. pixels) between localizations in"
" consecutive segments to be considered as intersecting"
),
)
undrift_aim_parser.add_argument(
"-r",
"--roiradius",
type=float,
default=60/130,
help=(
"max. drift (cam. pixels) between two consecutive"
" segments"
),
)

# local densitydd
density_parser = subparsers.add_parser(
"density", help="compute the local density of localizations"
Expand Down Expand Up @@ -1708,6 +1771,8 @@ def main():
)
elif args.command == "undrift":
_undrift(args.files, args.segmentation, args.nodisplay, args.fromfile)
elif args.command == "aim":
_undrift_aim(args.files, args.segmentation, args.intersectdist, args.roiradius)
elif args.command == "density":
_density(args.files, args.radius)
elif args.command == "dbscan":
Expand Down
2 changes: 1 addition & 1 deletion picasso/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION_NO = "0.7.3"
VERSION_NO = "0.7.5"
31 changes: 22 additions & 9 deletions picasso/aim.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,12 +628,15 @@ def aim(
Radius of the local search region in camera pixels. Should be
larger than the maximum expected drift within segmentation.
progress : picasso.lib.ProgressDialog (default=None)
Progress dialog. If None, progress is displayed with tqdm.
Progress dialog. If None, progress is displayed with into the
console.

Returns
-------
locs : _np.rec.array
Undrifted localizations.
new_info : list of 1 dict
Updated metadata.
drift : _np.rec.array
Drift in x and y directions (and z if applicable).
"""
Expand All @@ -649,14 +652,18 @@ def aim(
if val := inf.get("Height"):
height = val
if val := inf.get('Frames'):
n_frames = val
n_frames = val - locs["frame"].min()
if val := inf.get("Pixelsize"):
pixelsize = val
if _np.isnan(width * height * pixelsize * n_frames):
raise KeyError("Insufficient metadata available.")
raise KeyError(
"Insufficient metadata available. Please specify 'Width', 'Height',"
" 'Frames' and 'Pixelsize' in the metadata .yaml."
)

# frames should start at 1
frame = locs["frame"] + 1
frame = locs["frame"] + 1 - locs["frame"].min()

# find the segmentation bounds (temporal intervals)
seg_bounds = _np.concatenate((
_np.arange(0, n_frames, segmentation), [n_frames]
Expand Down Expand Up @@ -686,9 +693,13 @@ def aim(
drift_x = drift_x1 + drift_x2
drift_y = drift_y1 + drift_y2

# # shift the drifts by the mean value
drift_x -= _np.mean(drift_x)
drift_y -= _np.mean(drift_y)
# shift the drifts by the mean value
shift_x = _np.mean(drift_x)
shift_y = _np.mean(drift_y)
drift_x -= shift_x
drift_y -= shift_y
x_pdc += shift_x
y_pdc += shift_y

# combine to Picasso format
drift = _np.rec.array((drift_x, drift_y), dtype=[("x", "f"), ("y", "f")])
Expand All @@ -713,7 +724,9 @@ def aim(
aim_round=2, progress=progress,
)
drift_z = drift_z1 + drift_z2
drift_z -= _np.mean(drift_z)
shift_z = _np.mean(drift_z)
drift_z -= shift_z
z_pdc += shift_z
drift = _np.rec.array(
(drift_x, drift_y, drift_z),
dtype=[("x", "f"), ("y", "f"), ("z", "f")]
Expand All @@ -726,7 +739,7 @@ def aim(
locs["z"] = z_pdc

new_info = {
"Undrifted by": "AIM",
"Generated by": "AIM undrift",
"Intersect distance (nm)": intersect_d * pixelsize,
"Segmentation": segmentation,
"Search regions radius (nm)": roi_r * pixelsize,
Expand Down
5 changes: 2 additions & 3 deletions picasso/gausslq.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from tqdm import tqdm as _tqdm
import numba as _numba
import multiprocessing as _multiprocessing
from concurrent import futures as _futures
from concurrent import futures as _futures
from . import postprocess as _postprocess

try:
Expand Down Expand Up @@ -81,7 +81,6 @@ def _initial_parameters(spot, size, size_half):


def initial_parameters_gpufit(spots, size):

center = (size / 2.0) - 0.5
initial_width = _np.amax([size / 5.0, 1.0])

Expand Down Expand Up @@ -155,7 +154,7 @@ def fit_spot(spot):

def fit_spots(spots):
theta = _np.empty((len(spots), 6), dtype=_np.float32)
theta.fill(_np.nan)
# theta.fill(_np.nan)
for i, spot in enumerate(spots):
theta[i] = fit_spot(spot)
return theta
Expand Down
Loading