fixed errors detected by pylint

This commit is contained in:
Guillaume Raffy 2019-09-18 12:34:52 +02:00
parent d973c0e1cd
commit 228ae4ab54
7 changed files with 23 additions and 26 deletions

View File

@ -3,7 +3,8 @@ import json
class DacMetadata(object):
"""Represents a display_and_comments.txt metadata file"""
"""Represents a display_and_comments.txt metadata file."""
def __init__(self, dac_id, dac_file_path):
"""Contructor.

View File

@ -94,7 +94,6 @@ def print_ijopencvmat(src_mat):
print("pixel type : %d" % src_mat.type())
def test_opencv_calc_hist1():
src_image = opencv_core.Mat([128, 128])
histogram = opencv_imgproc.cvCalcHist(src_image) # pylint: disable=unused-variable
@ -215,6 +214,7 @@ def test_ijopencv_converter():
# white_mat = imread(white_image_file_path)
print('mat', mat)
def test_ijopencv_morphology_ex():
print(opencv_core.CV_VERSION())
# src_image = opencv_core.Mat(128, 128)
@ -237,7 +237,6 @@ def test_ijopencv_morphology_ex():
print_ijopencvmat(dst_image)
def test_opencv():
test_ijopencv_converter()
@ -247,7 +246,6 @@ def test_opencv():
test_ijopencv_morphology_ex()
# If a Jython script is run, the variable __name__ contains the string '__main__'.
# If a script is loaded as module, __name__ has a different value.
if __name__ in ['__builtin__', '__main__']:

View File

@ -78,7 +78,6 @@ class IImageEngine(ABC):
:param int structuring_element_radius:
"""
@abc.abstractmethod
def replace_border(self, image, band_width):
"""Overwrites the outer band of the image by duplicating the value of the pixels that touch this outer band

View File

@ -2,8 +2,8 @@
"""
from imageengine import IImage, IImageEngine
from ij import IJ
from ij.plugin import ImageCalculator
from ij import IJ # pylint: disable=import-error
from ij.plugin import ImageCalculator # pylint: disable=import-error
from ijopencv.ij import ImagePlusMatConverter # pylint: disable=import-error
from ijopencv.opencv import MatImagePlusConverter # pylint: disable=import-error
import org.bytedeco.javacpp.opencv_core as opencv_core # pylint: disable=import-error

View File

@ -6,11 +6,11 @@
# the 'greeting' output parameter, based on its type.
from ij import IJ # pylint: disable=import-error
from ij import ImagePlus # pylint: disable=import-error
from ij.process import ByteProcessor # pylint: disable=import-error
from ij.process import ImageStatistics
from ij.plugin import ImageCalculator
from ij.plugin import ZProjector
from ij import WindowManager
# from ij.process import ByteProcessor # pylint: disable=import-error
from ij.process import ImageStatistics # pylint: disable=import-error
from ij.plugin import ImageCalculator # pylint: disable=import-error
from ij.plugin import ZProjector # pylint: disable=import-error
from ij import WindowManager # pylint: disable=import-error
from catalog import Sequence, ImageCatalog
import preprocessing
# greeting = "Hello, " + name + "!"
@ -179,7 +179,9 @@ class Lipase(object):
return background_image
def estimate_white(self, sequence, channel_id):
return preprocessing.estimate_white([sequence], [channel_id], dark=None)
white_estimator = preprocessing.WhiteEstimator(open_size=75, close_size=75, average_size=75)
white_estimate = white_estimator.estimate_white([sequence], [channel_id], dark=None)
return white_estimate
def process_sequence(self, sequence_id):
'''
@ -208,7 +210,6 @@ def test_find_white():
depth_index = lipase.find_depth_index(src_image, white_seq)
def run_script():
test_find_white()

View File

@ -22,7 +22,6 @@ class WhiteEstimator(object):
IImageEngine.get_instance().mean_filter(white_estimate, radius=(self.average_size + 1) / 2)
def estimate_white(self, sequences, channel_ids, dark=None):
"""Estimation of the white fluorescence image shape of synchrotron light from experimental images of Telemos microscope.
@ -271,8 +270,8 @@ def test_preprocessing(raw_images_root_path):
white_estimate = white_estimator.estimate_white([sequence], ['DM300_327-353_fluo'])
# find_white_reference_image(white_estimate, sequence.get_white())
print(white_estimate)
IImageEngine.get_instance().save_as_tiff( white_estimate, './white_estimate.tiff' )
IImageEngine.get_instance().save_as_tiff(white_estimate, './white_estimate.tiff')
print('end')
if __name__ == '__main__':
test_preprocessing()
test_preprocessing(raw_images_root_path='/Users/graffy/ownCloud/ipr/lipase/raw-images')

View File

@ -2,25 +2,24 @@
"""
# # note: fiji's jython doesn't support encoding keyword
#https://imagej.net/Scripting_Headless
#@String lipase_src_root_path
#@String raw_images_root_path
# https://imagej.net/Scripting_Headless
# @String lipase_src_root_path
# @String raw_images_root_path
# String(label="Please enter your name",description="Name field") name
# OUTPUT String greeting
import sys
print('python version %s' % sys.version) # prints python version
sys.path.append(lipase_src_root_path) # necessary if run from fiji as script otherwise jython fails to find lipase's modules such as catalog
# it is necassary to add lipase's root path to the path if run from fiji as script otherwise jython fails to find lipase's modules such as catalog
sys.path.append(lipase_src_root_path) # pylint: disable=undefined-variable
from ij import IJ
# from lipase import Lipase, ImageLogger
from catalog import ImageCatalog
from preprocessing import WhiteEstimator
from preprocessing import test_preprocessing
from preprocessing import test_preprocessing # noqa: E402 pylint: disable=import-error,wrong-import-position
def run_script():
test_preprocessing(raw_images_root_path) # eg '/Users/graffy/ownCloud/ipr/lipase/raw-images'
test_preprocessing(raw_images_root_path) # eg '/Users/graffy/ownCloud/ipr/lipase/raw-images' pylint: disable=undefined-variable
# note : when launched from fiji, __name__ doesn't have the value "__main__", as when launched from python
run_script()