Skip to content

Commit f411163

Browse files
committed
Update 3 Python recipes that calling Aivia subprocess
- Change the hardcoded executable calls
1 parent a2227c9 commit f411163

4 files changed

Lines changed: 6 additions & 64 deletions

File tree

-184 Bytes
Binary file not shown.

Recipes/MaxIntensityProjection.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,6 @@
3030
Opens Aivia (again) to display the 2D projection as a new image.
3131
3232
"""
33-
#Get path to the Aivia executable
34-
def getParentDir(currDir, level=1):
35-
36-
for i in range(level):
37-
parentDir = up(currDir)
38-
currDir=parentDir
39-
40-
return currDir
41-
42-
exeDir=sys.executable
43-
parentDir=getParentDir(exeDir, level=2)
44-
if ('Aivia Community' in parentDir):
45-
aivia_path = parentDir + '\\Aivia-Community.exe'
46-
else:
47-
aivia_path = parentDir + '\\Aivia.exe'
48-
49-
if (not isfile(aivia_path)):
50-
raise FileNotFoundError(f"{aivia_path} does not exist")
51-
52-
print(f'Aivia path: {aivia_path}')
5333

5434

5535
# [INPUT Name:inputImagePath Type:string DisplayName:'Input Image']
@@ -58,6 +38,7 @@ def run(params):
5838
image_location = params['inputImagePath']
5939
result_location = params['resultPath']
6040
tCount = int(params['TCount'])
41+
aivia_path = params['CallingExecutable']
6142
if not os.path.exists(image_location):
6243
print(f"Error: {image_location} does not exist")
6344
return

Recipes/MaxIntensityProjectionRGB.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,6 @@
3232
3333
"""
3434

35-
#Get path to the Aivia executable
36-
def getParentDir(currDir, level=1):
37-
38-
for i in range(level):
39-
parentDir = up(currDir)
40-
currDir=parentDir
41-
42-
return currDir
43-
44-
exeDir=sys.executable
45-
parentDir=getParentDir(exeDir, level=2)
46-
if ('Aivia Community' in parentDir):
47-
aivia_path = parentDir + '\\Aivia-Community.exe'
48-
else:
49-
aivia_path = parentDir + '\\Aivia.exe'
50-
51-
if (not isfile(aivia_path)):
52-
raise FileNotFoundError(f"{aivia_path} does not exist")
53-
54-
print(f'Aivia path: {aivia_path}')
55-
5635

5736
# [INPUT Name:inputRedPath Type:string DisplayName:'Red channel']
5837
# [INPUT Name:inputGreenPath Type:string DisplayName:'Green channel']
@@ -65,7 +44,8 @@ def run(params):
6544
image_location.append(params['inputBluePath'])
6645
result_location = params['resultPath']
6746
tCount = int(params['TCount'])
68-
47+
aivia_path = params['CallingExecutable']
48+
6949
for c in range(0, 3):
7050
if not os.path.exists(image_location[c]):
7151
print(f"Error: {image_location[c]} does not exist")

Recipes/ScaleImage.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,6 @@
4141
"""
4242
interpolation_mode = 1 # 0: Nearest-neighbor, 1: Bi-linear , 2: Bi-quadratic, 3: Bi-cubic, 4: Bi-quartic, 5: Bi-quintic
4343

44-
# Get path to the Aivia executable
45-
def getParentDir(currDir, level=1):
46-
47-
for i in range(level):
48-
parentDir = up(currDir)
49-
currDir=parentDir
50-
51-
return currDir
52-
53-
exeDir = sys.executable
54-
parentDir = getParentDir(exeDir, level=2)
55-
if ('Aivia Community' in parentDir):
56-
aivia_path = parentDir + '\\Aivia-Community.exe'
57-
else:
58-
aivia_path = parentDir + '\\Aivia.exe'
59-
60-
if (not isfile(aivia_path)):
61-
raise FileNotFoundError(f"{aivia_path} does not exist")
62-
63-
print(f'Aivia path: {aivia_path}')
64-
6544

6645
# automatic parameters
6746

@@ -82,6 +61,7 @@ def run(params):
8261
tCount = int(params['TCount'])
8362
pixel_cal_tmp = params['Calibration']
8463
pixel_cal = pixel_cal_tmp[6:].split(', ') # Expects calibration with 'XYZT: ' in front
64+
aivia_path = params['CallingExecutable']
8565

8666
# Getting XY and Z values # Expecting only 'Micrometers' in this code
8767
XY_cal = float(pixel_cal[0].split(' ')[0])
@@ -180,4 +160,5 @@ def run(params):
180160
# v1_11: - tkinter not installed by default so removing all code and adding parameters in Aivia UI
181161
# v1_13: - Fallback values if factors equal 0 / automated detection of latest Aivia version on PC
182162
# v1_14: - Adding pixel/voxel calibration
183-
# v1_15: - Update Aivia path for Aivia community
163+
# v1_15: - Update Aivia path for Aivia community
164+
# v1_16: - Update aivia_path using new API

0 commit comments

Comments
 (0)