Skip to content

Commit 7fd2f5f

Browse files
Merge pull request #509 from jungmannlab/development
0.7.4
2 parents 14ce66c + 45d2713 commit 7fd2f5f

File tree

14 files changed

+553
-243
lines changed

14 files changed

+553
-243
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.7.3
2+
current_version = 0.7.4
33
commit = True
44
tag = False
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?

changelog.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
Changelog
22
=========
33

4-
Last change: 02-OCT-2024 MTS
4+
Last change: 14-DEC-2024 MTS
55

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

1321
0.7.0

distribution/picasso.iss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
AppName=Picasso
33
AppPublisher=Jungmann Lab, Max Planck Institute of Biochemistry
44

5-
AppVersion=0.7.3
5+
AppVersion=0.7.4
66
DefaultDirName={commonpf}\Picasso
77
DefaultGroupName=Picasso
8-
OutputBaseFilename="Picasso-Windows-64bit-0.7.3"
8+
OutputBaseFilename="Picasso-Windows-64bit-0.7.4"
99
ArchitecturesAllowed=x64
1010
ArchitecturesInstallIn64BitMode=x64
1111

docs/cmd.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ undrift
7878
-------
7979
Correct localization coordinates for drift with RCC.
8080

81+
aim
82+
-------
83+
Correct localization coordinates for drift with AIM.
84+
8185
density
8286
-------
8387
Compute the local density of localizations

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# The short X.Y version
2727
version = ""
2828
# The full version, including alpha/beta/rc tags
29-
release = "0.7.3"
29+
release = "0.7.4"
3030

3131
# -- General configuration ---------------------------------------------------
3232

picasso/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import os.path as _ospath
99
import yaml as _yaml
1010

11-
__version__ = "0.7.3"
11+
__version__ = "0.7.4"
1212

1313
_this_file = _ospath.abspath(__file__)
1414
_this_dir = _ospath.dirname(_this_file)

picasso/__main__.py

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,26 @@ def _undrift(files, segmentation, display=True, fromfile=None):
423423
savetxt(base + "_drift.txt", drift, header="dx\tdy", newline="\r\n")
424424

425425

426+
def _undrift_aim(
427+
files, segmentation, intersectdist=20/130, roiradius=60/130
428+
):
429+
import glob
430+
from . import io, aim
431+
from numpy import savetxt
432+
433+
paths = glob.glob(files)
434+
for path in paths:
435+
try:
436+
locs, info = io.load_locs(path)
437+
except io.NoMetadataFileError:
438+
continue
439+
print("Undrifting file {}".format(path))
440+
locs, new_info, drift = aim.aim(locs, info, segmentation, intersectdist, roiradius)
441+
base, ext = os.path.splitext(path)
442+
io.save_locs(base + "_aim.hdf5", locs, new_info)
443+
savetxt(base + "_aimdrift.txt", drift, header="dx\tdy", newline="\r\n")
444+
445+
426446
def _density(files, radius):
427447
import glob
428448

@@ -985,6 +1005,7 @@ def prompt_info():
9851005
print("------------------------------------------")
9861006

9871007
info.append(localize_info)
1008+
info.append(camera_info)
9881009

9891010
base, ext = splitext(path)
9901011

@@ -1210,12 +1231,12 @@ def main():
12101231
" specified by a unix style path pattern"
12111232
),
12121233
)
1213-
undrift_parser.add_argument(
1214-
"-m",
1215-
"--mode",
1216-
default="render",
1217-
help='"std", "render" or "framepair")',
1218-
)
1234+
# undrift_parser.add_argument(
1235+
# "-m",
1236+
# "--mode",
1237+
# default="render",
1238+
# help='"std", "render" or "framepair")',
1239+
# )
12191240
undrift_parser.add_argument(
12201241
"-s",
12211242
"--segmentation",
@@ -1239,6 +1260,48 @@ def main():
12391260
help="do not display estimated drift",
12401261
)
12411262

1263+
# undrift by AIM parser
1264+
undrift_aim_parser = subparsers.add_parser(
1265+
"aim", help="correct localization coordinates for drift with AIM"
1266+
)
1267+
undrift_aim_parser.add_argument(
1268+
"files",
1269+
help=(
1270+
"one or multiple hdf5 localization files"
1271+
" specified by a unix style path pattern"
1272+
),
1273+
)
1274+
undrift_aim_parser.add_argument(
1275+
"-s",
1276+
"--segmentation",
1277+
type=float,
1278+
default=100,
1279+
help=(
1280+
"the number of frames to be combined"
1281+
" for one temporal segment (default=100)"
1282+
),
1283+
)
1284+
undrift_aim_parser.add_argument(
1285+
"-i",
1286+
"--intersectdist",
1287+
type=float,
1288+
default=20/130,
1289+
help=(
1290+
"max. distance (cam. pixels) between localizations in"
1291+
" consecutive segments to be considered as intersecting"
1292+
),
1293+
)
1294+
undrift_aim_parser.add_argument(
1295+
"-r",
1296+
"--roiradius",
1297+
type=float,
1298+
default=60/130,
1299+
help=(
1300+
"max. drift (cam. pixels) between two consecutive"
1301+
" segments"
1302+
),
1303+
)
1304+
12421305
# local densitydd
12431306
density_parser = subparsers.add_parser(
12441307
"density", help="compute the local density of localizations"
@@ -1708,6 +1771,8 @@ def main():
17081771
)
17091772
elif args.command == "undrift":
17101773
_undrift(args.files, args.segmentation, args.nodisplay, args.fromfile)
1774+
elif args.command == "aim":
1775+
_undrift_aim(args.files, args.segmentation, args.intersectdist, args.roiradius)
17111776
elif args.command == "density":
17121777
_density(args.files, args.radius)
17131778
elif args.command == "dbscan":

picasso/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION_NO = "0.7.3"
1+
VERSION_NO = "0.7.4"

picasso/aim.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,8 @@ def aim(
634634
-------
635635
locs : _np.rec.array
636636
Undrifted localizations.
637+
new_info : list of 1 dict
638+
Updated metadata.
637639
drift : _np.rec.array
638640
Drift in x and y directions (and z if applicable).
639641
"""
@@ -686,9 +688,13 @@ def aim(
686688
drift_x = drift_x1 + drift_x2
687689
drift_y = drift_y1 + drift_y2
688690

689-
# # shift the drifts by the mean value
690-
drift_x -= _np.mean(drift_x)
691-
drift_y -= _np.mean(drift_y)
691+
# shift the drifts by the mean value
692+
shift_x = _np.mean(drift_x)
693+
shift_y = _np.mean(drift_y)
694+
drift_x -= shift_x
695+
drift_y -= shift_y
696+
x_pdc += shift_x
697+
y_pdc += shift_y
692698

693699
# combine to Picasso format
694700
drift = _np.rec.array((drift_x, drift_y), dtype=[("x", "f"), ("y", "f")])
@@ -713,7 +719,9 @@ def aim(
713719
aim_round=2, progress=progress,
714720
)
715721
drift_z = drift_z1 + drift_z2
716-
drift_z -= _np.mean(drift_z)
722+
shift_z = _np.mean(drift_z)
723+
drift_z -= shift_z
724+
z_pdc += shift_z
717725
drift = _np.rec.array(
718726
(drift_x, drift_y, drift_z),
719727
dtype=[("x", "f"), ("y", "f"), ("z", "f")]
@@ -726,7 +734,7 @@ def aim(
726734
locs["z"] = z_pdc
727735

728736
new_info = {
729-
"Undrifted by": "AIM",
737+
"Generated by": "AIM undrift",
730738
"Intersect distance (nm)": intersect_d * pixelsize,
731739
"Segmentation": segmentation,
732740
"Search regions radius (nm)": roi_r * pixelsize,

0 commit comments

Comments
 (0)