Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
fc5cef8
first commit, new protocol to detect misalignment
fede-pe Nov 4, 2021
6bade50
add protocol to init
fede-pe Nov 4, 2021
c1a925f
add to protocols conf
fede-pe Nov 4, 2021
3866d99
first form draft finished
fede-pe Nov 4, 2021
8c930fe
new method to write xmipp tilt angle file from ts
fede-pe Nov 5, 2021
80662ae
convert input step
fede-pe Nov 5, 2021
ca85a2f
execute command
fede-pe Nov 5, 2021
e3d5a9a
new method to read metadata files
fede-pe Nov 10, 2021
74a492b
read enable info
fede-pe Nov 10, 2021
3770fa4
add default values
fede-pe Nov 11, 2021
15dd8e4
change fid size to nm
fede-pe Nov 11, 2021
ea545df
fixes
fede-pe Nov 11, 2021
b5741fd
method to read coordinates files
fede-pe Nov 11, 2021
964b774
enhance readXmippMetadataEnabledTiltImages performance
fede-pe Nov 11, 2021
5107482
fixes noww working
fede-pe Nov 11, 2021
f75315d
generate outputset of tilt series
fede-pe Nov 15, 2021
ae92732
update output paths
fede-pe Nov 15, 2021
fc82f00
fixes in xmd tilt angle file generation
fede-pe Nov 15, 2021
d6ef067
adapt protocol to new file parsing
fede-pe Nov 15, 2021
37a5a6f
add detect misalignment
fede-pe Nov 15, 2021
8a6fd99
generate alignment report dictionary
fede-pe Nov 16, 2021
8157143
summaty completed with report
fede-pe Nov 16, 2021
659b045
fixes in summary, everything OK
fede-pe Nov 16, 2021
d9d74eb
remove debug code
fede-pe Nov 25, 2021
8f4c609
update form with new params
fede-pe Nov 30, 2021
6b40336
change default value
fede-pe Nov 30, 2021
01517a7
parellize protocol
fede-pe Dec 20, 2021
a767376
add try catch debug
fede-pe Jan 12, 2022
592aa45
remove if statement debug
fede-pe Jan 12, 2022
2dd6266
remove if statement debug
fede-pe Jan 12, 2022
97fb779
remove if statement debug III
fede-pe Jan 12, 2022
615ff15
remove if statement debug IV
fede-pe Jan 12, 2022
e6a22d0
remove if statement debug V
fede-pe Jan 12, 2022
16602ed
remove if statement debug VI
fede-pe Jan 12, 2022
8682e85
remove if statement debug VI
fede-pe Jan 12, 2022
d9bcbed
remove if statement debug VII
fede-pe Jan 12, 2022
82609d1
fixing sets I
fede-pe Jan 12, 2022
a895b4b
fixes pablo I
fede-pe Jan 13, 2022
f49760d
fixes pablo II
fede-pe Jan 13, 2022
2501dfe
fixes pablo III
fede-pe Jan 13, 2022
0b7894b
rename
fede-pe Jan 21, 2022
ba57f71
new method to generate xmd files from coordinates
fede-pe Apr 5, 2022
aed26d0
generate coordinates xmd file
fede-pe Apr 5, 2022
1b90f8e
update command to new parameters
fede-pe Apr 5, 2022
f08e70a
update requirements (statsmodels and dependecies)
fede-pe Apr 6, 2022
1098899
new mehots to generate residual statistical information table from xm…
fede-pe Apr 6, 2022
6d8183b
generating ouptut as string in progress. END OF SESSION
fede-pe Apr 6, 2022
dbc07ce
fixes, end of session
fede-pe Apr 6, 2022
fa024c6
fixes + report info in summary
fede-pe Apr 7, 2022
fe2e716
merge with devel
fede-pe May 4, 2022
0f39bee
fixes in protocols conf after merging
fede-pe May 4, 2022
93ecf7b
use check for missing cooridnates
fede-pe May 6, 2022
6be894d
add method to utils to calculate rotation angle from transformation m…
fede-pe May 18, 2022
5fd5db0
use swapxy logic in apply transformation matrices in ts
fede-pe May 18, 2022
77ae449
refactor
fede-pe May 18, 2022
ca49793
fixes in converti input step interpolation
fede-pe May 19, 2022
d9af3f5
Merge branch 'devel' into fi_feature_detectMisalignment
fede-pe Jun 8, 2022
27c5fb0
return avg rotation angle as 0 when ti has no trasnform·
fede-pe Jun 8, 2022
57a0dee
new method to generate xmd with tilt series 3d coordiantes
fede-pe Jun 8, 2022
239bbe6
adapt protocol to new tilt series 3d coordinates object
fede-pe Jun 8, 2022
dd77b84
use dimentions from sot of soc
fede-pe Jun 9, 2022
76634c6
test in herts-dos
fede-pe Jun 9, 2022
24c7999
correct dimensions for coordinates
fede-pe Jun 9, 2022
34a8dd4
merge devel
fede-pe Jun 16, 2022
14c449b
fixes from merging with devel I
fede-pe Jun 16, 2022
22ea983
changes due to fixes in tilt sereis coordinates object
fede-pe Jun 16, 2022
cd187c1
fixes in summary
fede-pe Jun 22, 2022
4344d77
add param to threshold distance coord projection-fiducial detected
fede-pe Sep 8, 2022
7d33002
merge devel, solve conflicts
fede-pe Dec 29, 2022
991bb6e
method to read residual info from xmd file
fede-pe Jan 2, 2023
d329caf
split LM in ali and misali
fede-pe Jan 2, 2023
d13484f
close lm sets
fede-pe Jan 2, 2023
6c25a6d
generate output set of landmark models
fede-pe Jan 2, 2023
2de0b7e
fixes
fede-pe Jan 2, 2023
42577e7
Merge branch 'devel' into fi_feature_detectMisalignment
fede-pe Feb 21, 2023
829693a
comment deprecated code, raises error with new xmipp program version
fede-pe Feb 23, 2023
20f4e34
Merge branch 'devel' into fi_feature_detectMisalignment
fede-pe Feb 28, 2023
ddc24f8
make avgResidPercentile_LocalAlignment param
fede-pe Mar 7, 2023
c77fffc
remove debug code
fede-pe Mar 8, 2023
a4a32d4
fix in getOutputSetOfAlignedLandmarkModels
fede-pe Mar 8, 2023
1e9553c
fixes in getOutputSetOfMisalignedTiltSeries and getOutputSetOfAligned…
fede-pe Mar 8, 2023
2d5bd2b
fixes in getOutputSetOfMisalignedTiltSeries and getOutputSetOfAligned…
fede-pe Mar 8, 2023
d31baab
Merge branch 'devel' into fi_feature_detectMisalignment
fede-pe Apr 3, 2023
a9bfe8a
update default params·
fede-pe Apr 10, 2023
c5f8873
merge with devel
fede-pe Jun 8, 2023
39a00eb
fixes in output .sfid generation
fede-pe Jun 15, 2023
89e1791
create protocol
fede-pe Jun 27, 2023
f15f41a
first protocol scratch
fede-pe Jun 27, 2023
9b95dda
add to init
fede-pe Jun 27, 2023
4c768eb
add to portocols confW
fede-pe Jun 27, 2023
02e7449
convert input step
fede-pe Jun 27, 2023
30e988b
compose xmipp comand step
fede-pe Jun 27, 2023
25e9271
add create output step
fede-pe Jun 27, 2023
6caf583
fix class name
fede-pe Jun 27, 2023
957036f
create method to parse lm file
fede-pe Jun 27, 2023
7b7a121
close outptu step
fede-pe Jun 27, 2023
59a8d6a
fixes I
fede-pe Jun 27, 2023
4f2313d
fixes II
fede-pe Jun 27, 2023
b3863e1
remove debug code
fede-pe Jun 29, 2023
dd1e78f
merge with detect_landmarks
fede-pe Jul 3, 2023
6a5df4d
merge with devel, solve conflicts
fede-pe Jul 5, 2023
2fbc8d9
fix otuput landmark model generation
fede-pe Jul 12, 2023
82c1995
adapt variables and command composition to new xmipp program
fede-pe Jul 13, 2023
8d508a0
set applyTSTransformation as True in outputLM
fede-pe Jul 20, 2023
3a42834
comment removed avgResidPercentile_LocalAlignment program param
fede-pe Jul 20, 2023
1eb1c3e
remove unused params
fede-pe Jul 27, 2023
47972df
new protocol version using splitted programs
fede-pe Jul 27, 2023
dd021e2
first structure accepting SoLM as input
fede-pe Jul 28, 2023
6469ea2
allow isots or isolm as input
fede-pe Jul 31, 2023
c6310ba
new method to generate res mod info file
fede-pe Jul 31, 2023
dd5ad6d
fixes in setoflandmark models mode
fede-pe Jul 31, 2023
002de92
remove unused imports
fede-pe Jul 31, 2023
b35f208
fixes when input us a SOLM
fede-pe Jul 31, 2023
f6411e8
remove debug code
fede-pe Jul 31, 2023
e215864
fixes in validate
fede-pe Aug 1, 2023
0e78b20
fixes in vResMod file generation
fede-pe Aug 1, 2023
f7e804f
check for residuals with modeule equal zero
fede-pe Aug 1, 2023
fb4fc4a
mege with devel. Resolve conflicts·
fede-pe Nov 8, 2023
fbcd862
fix in util method for alingment report reading
fede-pe Nov 28, 2023
ac949bc
fix introduces typo
fede-pe Nov 28, 2023
8028973
fix filenames vResMod
fede-pe Dec 1, 2023
512d212
Merge branch 'devel' into fi_feature_detectMisalignment
fede-pe Dec 4, 2023
c5ac92e
Merge branch 'devel' into fi_feature_detectMisalignment
fede-pe Dec 15, 2023
473eff9
refactor, update hertz-dos
fede-pe Jan 16, 2024
0ba9e22
iterate over lm model is used as input to avoid non complete sets2
fede-pe Jan 17, 2024
bd000e4
set image threshold for local misalignment
fede-pe Jan 18, 2024
a33f39f
RESOLVE CONFLICTS
fede-pe Feb 5, 2024
1832c99
commit to start new process
fede-pe Feb 14, 2024
686e8f5
integrate xmipp_tomo_tiltseries_detect_misalignment_corr in protocol …
fede-pe Feb 14, 2024
7c8daff
add todo + fix typo
fede-pe Feb 15, 2024
71e193b
add parallel section to detect msiali
fede-pe Feb 19, 2024
c220da4
generate tilt angle file always
fede-pe Feb 21, 2024
6f39f56
fixes in tilt series coordinates
fede-pe Feb 28, 2024
120bd3c
add subtleMisaliToggle
fede-pe Feb 28, 2024
1f87565
trigger subtle misalignment only if ts aligned
fede-pe Feb 28, 2024
d315b1b
remove TODO comments
fede-pe Feb 29, 2024
8be7ab3
improve help form
fede-pe Mar 6, 2024
f33b1c7
new form to consider ts coming from lm
fede-pe Mar 6, 2024
4843373
new logic of tilt-seris + improve form help
fede-pe Mar 6, 2024
5743298
allow null in form
fede-pe Mar 6, 2024
64bf6da
change structure, now no input ts is needed to detect misali from res…
fede-pe Mar 17, 2024
27b16f6
add condition to check if Lm do not brin gresidual informatioN
fede-pe Mar 18, 2024
1b2c2b6
use NaN form residual info
fede-pe Apr 1, 2024
6df1e42
do not analyze landmark with no residual info
fede-pe Apr 2, 2024
1483687
new parameter with number of tilt images
fede-pe Apr 2, 2024
025d681
remove residual outliers as option
fede-pe Apr 3, 2024
d96aa22
add numberFTdirOfDirections option
fede-pe Apr 11, 2024
3b8faad
fix from previos commit
fede-pe Apr 11, 2024
c492cab
add votting criteria
fede-pe Apr 16, 2024
f6337ac
fix form
fede-pe Jul 20, 2024
6840665
solve conflics
fede-pe Feb 14, 2025
5a9fbdc
merge devel
fede-pe Feb 14, 2025
35b822b
merge with detect lm ts
fede-pe Feb 14, 2025
48d0a97
remove deprecated protocols from init
fede-pe Feb 17, 2025
bd85dce
rename protocl to covnention
fede-pe Feb 17, 2025
981babd
update init with detect landmark in ts
fede-pe Feb 17, 2025
f68a000
add FT directions to params in detect LM
fede-pe Feb 17, 2025
90c5257
add FT directions to params in detect LM
fede-pe Feb 17, 2025
8ee2208
remove unused params from protocol
fede-pe Feb 17, 2025
86bc2c0
update output generation in landmark detection
fede-pe Feb 17, 2025
47f0675
fix output generatioN
fede-pe Feb 17, 2025
aa264bf
save fid size in angstroms
fede-pe Feb 17, 2025
92d3edb
update default params
fede-pe Feb 17, 2025
185adbb
update default params
fede-pe Feb 17, 2025
2031590
remove subtle misalignemnt form protocol
fede-pe Feb 18, 2025
c577eee
add paramthrRatioMahalanobis to program
fede-pe Feb 18, 2025
ec8f526
update builPlugin.yml
fede-pe Feb 18, 2025
8d9f647
update builPlugin.yml II
fede-pe Feb 18, 2025
3f95ca0
update builPlugin.yml III
fede-pe Feb 18, 2025
dcdfe4f
update builPlugin.yml IV
fede-pe Feb 19, 2025
e65f002
PR fixes I: remove rotate astigmatism from protocols.conf
fede-pe Mar 1, 2025
3711913
PR fixes II: update help
fede-pe Mar 1, 2025
f889365
PR fixes III: do not generate output if no landmark is detected in TS
fede-pe Mar 1, 2025
5f96b85
PR fixes IV: remove commented code
fede-pe Mar 1, 2025
5ab3530
PR fixes V: use metadata to write coordinates file
fede-pe Mar 1, 2025
6230b24
Fix: remove unused import
fede-pe Mar 1, 2025
b064b0b
PR fixes VI: e
fede-pe Mar 1, 2025
c040a2c
Added workflow dispatch trigger to the build action
oierlauzi May 19, 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
11 changes: 6 additions & 5 deletions .github/workflows/buildPlugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [devel, master]

workflow_dispatch:


# Define the job that should be run
jobs:
build:
Expand Down Expand Up @@ -101,12 +104,10 @@ jobs:
working-directory: ${{ github.workspace }}
run: ../scipion/scipion3 installp -p . --devel

# Currently, test script is being downloaded from scipion-chem, but that should be temporary
# Ideally, the script might be included in scipion core to be able to import it,
# or maybe host it in a separate repository common with useful scripts for all scipion plugins
- name: Run tests
working-directory: ${{ github.workspace }}/${{ vars.FOLDER_WITH_VERSION }}
run: |
wget https://raw.githubusercontent.com/scipion-chem/scipion-chem/devel/pwchem/runTests.py
eval "$(${{ github.workspace }}/../miniconda/bin/conda shell.bash hook)"
python runTests.py ${{ github.workspace }}/../scipion/scipion3 ${{ vars.FOLDER_WITH_VERSION }} -noGPU -testData=testData.json -j=3
pip install --user scipion-testrunner
${{ github.workspace }}/../scipion/scipion3 run conda install -c conda-forge libstdcxx-ng
scipion_testrunner ${{ github.workspace }}/../scipion/scipion3 ${{ vars.FOLDER_WITH_VERSION }} --noGpu --testData=testData.json
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ scipion-em-xmipp
scipion-em-tomo
scipion-em >= 3.0.8
scipion-em-xmippBase
pandas <= 1.3.5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dependence is on Scipion, I guess @oierlauzi

Copy link
Contributor Author

@fede-pe fede-pe Mar 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there is no dependency on pandas in any of the required packages by this plugin. That's why this is added here.

statsmodels
4 changes: 4 additions & 0 deletions xmipptomo/protocols.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ Tomography = [
{"tag": "protocol_group", "text": "Tilt-series preprocess", "openItem": "False", "children": [
{"tag": "protocol", "value": "XmippProtResizeTiltSeries", "text": "default"},
{"tag": "protocol", "value": "XmippProtApplyTransformationMatrixTS", "text": "default"},
{"tag": "protocol", "value": "XmippProtDetectLandmarkTS", "text": "default"},
{"tag": "protocol", "value": "XmippProtSplitTiltSeries", "text": "default"}
]},
{"tag": "protocol_group", "text": "Alignment", "openItem": "False", "children": [
{"tag": "protocol", "value": "XmippProtDetectMisalignmentTiltSeries", "text": "default"}
]}
]},
{"tag": "section", "text": "Tomograms", "children": [
Expand Down
2 changes: 2 additions & 0 deletions xmipptomo/protocols/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
from .protocol_crop_tomograms import XmippProtCropTomograms
from .protocol_extract_subtomos import XmippProtExtractSubtomos
from .protocol_flexalign import XmippProtTsFlexAlign
from .protocol_detect_misalignment_TS import XmippProtDetectMisalignmentTiltSeries
from .protocol_detect_landmarks_TS import XmippProtDetectLandmarkTS
from .protocol_peak_high_contrast import XmippProtPeakHighContrast
from .protocol_phantom_subtomo import XmippProtPhantomSubtomo
from .protocol_phantom_tomo import XmippProtPhantomTomo
Expand Down
2 changes: 1 addition & 1 deletion xmipptomo/protocols/protocol_applyAlignmentTS.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# **************************************************************************
# *
# * Authors: Federico P. de Isidro Gomez (fp.deisidro@cnb.csi.es) [1]
# * Authors: Federico P. de Isidro Gomez (fp.deisidro@cnb.csic.es) [1]
# *
# * [1] Centro Nacional de Biotecnologia, CSIC, Spain
# *
Expand Down
240 changes: 240 additions & 0 deletions xmipptomo/protocols/protocol_detect_landmarks_TS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
# **************************************************************************
# *
# * Authors: Federico P. de Isidro Gomez (fp.deisidro@cnb.csi.es) [1]
# *
# * [1] Centro Nacional de Biotecnologia, CSIC, Spain
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 2 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# * 02111-1307 USA
# *
# * All comments concerning this program package may be sent to the
# * e-mail address 'scipion@cnb.csic.es'
# *
# **************************************************************************

import os
from pyworkflow import BETA
import pyworkflow.protocol.params as params
import pyworkflow.utils.path as path
from pyworkflow.object import Set, Boolean
from pyworkflow.protocol.constants import STEPS_PARALLEL
from pwem.protocols import EMProtocol
import tomo.objects as tomoObj
from tomo.protocols import ProtTomoBase
import xmipptomo.utils as utils


OUTPUT_COORDS_FILENAME = "outputLandmarkCoordinates.xmd"


class XmippProtDetectLandmarkTS(EMProtocol, ProtTomoBase):
"""
Scipion protocol for xmipp_tomo_detect_landmarks. This protocol detect fiducial landmarks in a tilt series. It will
not produce a correspondence of landmark between images so chains will not be constructed only single landmark per
tilt image.
"""

_label = 'detect landmarks TS'
_devStatus = BETA

def __init__(self, **kwargs):
EMProtocol.__init__(self, **kwargs)
ProtTomoBase.__init__(self)
self.stepsExecutionMode = STEPS_PARALLEL

# -------------------------- DEFINE param functions -----------------------
def _defineParams(self, form):
form.addSection('Input')

form.addParam('inputSetOfTiltSeries',
params.PointerParam,
pointerClass='SetOfTiltSeries',
important=True,
label='Input set of tilt-series')

form.addParam('fiducialSize',
params.FloatParam,
important=True,
label='Landmark size (nm)',
help='Landmark size in nanometers (nm).')

# Advanced params
form.addParam('thrSD',
params.FloatParam,
expertLevel=params.LEVEL_ADVANCED,
default=5,
label='Coordinate value SD threshold',
help='Number of SD a coordinate value must be over the mean to consider that it belongs to a '
'high contrast feature.')

form.addParam('targetLMsize',
params.FloatParam,
expertLevel=params.LEVEL_ADVANCED,
default=8,
label='Target landmark size (px)',
help='Target landmark size to adjust down sampling before filtering. Default value is 8 px.')

form.addParam('numberFTdirOfDirections',
params.IntParam,
expertLevel=params.LEVEL_ADVANCED,
default=16,
label='Fourier filter directions',
help='Number of directions to analyze in the Fourier directional filter.')

# -------------------------- INSERT steps functions ---------------------
def _insertAllSteps(self):
allcosId = []

for ts in self.inputSetOfTiltSeries.get():
tsObjId = ts.getObjId()
cisID = self._insertFunctionStep(self.convertInputStep,
tsObjId,
prerequisites=[])
dlsID = self._insertFunctionStep(self.detectLandmarksStep,
tsObjId,
prerequisites=[cisID])
cosID = self._insertFunctionStep(self.createOutputStep,
tsObjId,
prerequisites=[dlsID])
allcosId.append(cosID)

self._insertFunctionStep(self.closeOutputSetsStep,
prerequisites=allcosId)

# --------------------------- STEPS functions ----------------------------
def convertInputStep(self, tsObjId):
ts = self.inputSetOfTiltSeries.get()[tsObjId]
tsId = ts.getTsId()

extraPrefix = self._getExtraPath(tsId)
tmpPrefix = self._getTmpPath(tsId)

path.makePath(tmpPrefix)
path.makePath(extraPrefix)

firstItem = ts.getFirstItem()

"""Apply the transformation form the input tilt-series"""
# Use Xmipp interpolation via Scipion
if firstItem.hasTransform():
avgRotAngle = utils.calculateAverageRotationAngleFromTM(ts)
swap = True if (avgRotAngle > 45 or avgRotAngle < -45) else False

outputTsFileName = os.path.join(tmpPrefix, firstItem.parseFileName())
ts.applyTransform(outputTsFileName, swapXY=swap)

else:
outputTsFileName = os.path.join(tmpPrefix, firstItem.parseFileName())
ts.applyTransform(outputTsFileName)

def detectLandmarksStep(self, tsObjId):
ts = self.inputSetOfTiltSeries.get()[tsObjId]
tsId = ts.getTsId()

extraPrefix = self._getExtraPath(tsId)
tmpPrefix = self._getTmpPath(tsId)

firstItem = ts.getFirstItem()

params = {
'i': os.path.join(tmpPrefix, firstItem.parseFileName() + ":mrcs"),
'o': os.path.join(extraPrefix, OUTPUT_COORDS_FILENAME),
'thrSD': self.thrSD.get(),
'samplingRate': self.inputSetOfTiltSeries.get().getSamplingRate(),
'fiducialSize': self.fiducialSize.get() * 10,
'targetLMsize': self.targetLMsize.get(),
'numberFTdirOfDirections': self.numberFTdirOfDirections.get()
}

args = "-i %(i)s " \
"-o %(o)s " \
"--thrSD %(thrSD).2f " \
"--samplingRate %(samplingRate).2f " \
"--fiducialSize %(fiducialSize).2f " \
"--targetLMsize %(targetLMsize).4f " \
"--numberFTdirOfDirections %(numberFTdirOfDirections)d "

self.runJob('xmipp_tomo_detect_landmarks', args % params)

def createOutputStep(self, tsObjId):
ts = self.inputSetOfTiltSeries.get()[tsObjId]
tsId = ts.getTsId()

extraPrefix = self._getExtraPath(tsId)

firstItem = ts.getFirstItem()

self.getOutputSetOfLandmarkModels()

lmFileName = os.path.join(extraPrefix, firstItem.parseFileName(suffix='_lm', extension='.sfid'))
lm = tomoObj.LandmarkModel(tsId=tsId,
fileName=lmFileName,
modelName=None,
size=self.fiducialSize.get() * 10,
applyTSTransformation=Boolean(False))
lm.setTiltSeries(ts)

lmList = utils.parseLandmarkCoordinatesFile(os.path.join(extraPrefix, OUTPUT_COORDS_FILENAME))

if not lmList:
print("WARNING: no landmark detected in tilt-series")
return # Do not create output if no detected landmarks in tilt-series

for i, lmInfo in enumerate(lmList):
lm.addLandmark(xCoor=lmInfo[0],
yCoor=lmInfo[1],
tiltIm=lmInfo[2]+1,
chainId=i+1,
xResid=0.0,
yResid=0.0)

self.outputSetOfLandmarkModels.append(lm)
self._store()

def closeOutputSetsStep(self):
if hasattr(self, "outputSetOfLandmarkModels"):
self.outputSetOfLandmarkModels.setStreamState(Set.STREAM_CLOSED)
self.outputSetOfLandmarkModels.write()

self._store()

# --------------------------- UTILS functions ----------------------------
def getOutputSetOfLandmarkModels(self):
if hasattr(self, "outputSetOfLandmarkModels"):
self.outputSetOfLandmarkModels.setStreamState(Set.STREAM_OPEN)
self.outputSetOfLandmarkModels.enableAppend()

else:
outputSetOfLandmarkModels = self._createSetOfLandmarkModels()
outputSetOfLandmarkModels.setSetOfTiltSeries(self.inputSetOfTiltSeries)

outputSetOfLandmarkModels.copyInfo(self.inputSetOfTiltSeries.get())

outputSetOfLandmarkModels.setStreamState(Set.STREAM_OPEN)

self._defineOutputs(outputSetOfLandmarkModels=outputSetOfLandmarkModels)
self._defineSourceRelation(self.inputSetOfTiltSeries, outputSetOfLandmarkModels)

return self.outputSetOfLandmarkModels

# --------------------------- INFO functions ----------------------------
def _summary(self):
summary = []
return summary

def _methods(self):
methods = []

return methods
Loading
Loading