-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
import pytest | ||
|
||
from pymapmanager.interface2 import PyMapManagerApp | ||
# from pymapmanager import stack | ||
from mapmanagercore.data import getTiffChannel_1 | ||
|
||
from pymapmanager._logger import logger | ||
|
||
# this makes qapp be our PyMapManagerApp, it is derived from QApplication | ||
@pytest.fixture(scope="session") | ||
def qapp_cls(): | ||
return PyMapManagerApp | ||
|
||
def test_app(qtbot, qapp): | ||
logger.info(f'app:{qapp}') | ||
|
||
def test_load_tiff(qapp): | ||
tiffpath = getTiffChannel_1() | ||
|
||
qapp.loadStackWidget(tiffpath) | ||
|
||
def test_stack_from_tif(): | ||
import pandas as pd | ||
from mapmanagercore import MapAnnotations, MultiImageLoader | ||
|
||
tiffpath = getTiffChannel_1() | ||
|
||
loader = MultiImageLoader() | ||
loader.read(tiffpath, channel=0) | ||
# loader.read(tiffpath, channel=1) # our core is defaulting to channel 1 (for brightest path) | ||
|
||
map = MapAnnotations(loader, | ||
lineSegments=pd.DataFrame(), | ||
points=pd.DataFrame()) | ||
|
||
map.points[:] | ||
map.segments[:] | ||
|
||
print('map:', map) | ||
print('map.points[:]:', map.points[:]) | ||
print('map.segments[:]:', map.segments[:]) | ||
|
||
# get one time point. Stack does this but it seems to be buggy | ||
sessionID = 0 | ||
tp = map.getTimePoint(sessionID) | ||
|
||
print('tp:', map) | ||
print('tp.points[:]:', tp.points[:]) | ||
print('tp.segments[:]:', tp.segments[:]) | ||
|
||
if 1: | ||
newSegmentID = tp.newSegment() | ||
print('newSegmentID:', newSegmentID) | ||
|
||
tp.appendSegmentPoint(newSegmentID, 10, 10, 0) | ||
tp.appendSegmentPoint(newSegmentID, 20, 20, 0) | ||
tp.appendSegmentPoint(newSegmentID, 30, 30, 0) | ||
|
||
# TODO: fix error if we pass in (0, 0, 0) | ||
newSpineID = tp.addSpine(segmentId=newSegmentID, | ||
x=10, | ||
y=10, | ||
z=10) | ||
|
||
print('=== after add segment and spine') | ||
print('=== tp.points[:]:') | ||
print(tp.points[:]) | ||
print('===tp.segments[:]:') | ||
print(tp.segments[:]) | ||
|
||
# aStack = stack(zarrMap=map) | ||
|
||
if __name__ == '__main__': | ||
test_stack_from_tif() | ||
pass |