<s> """<STR_LIT>""" <EOL> __version__ = "<STR_LIT>" <EOL> import os <EOL> import unittest <EOL> import javabridge as J <EOL> from bioformats import load_image <EOL> import imagej . imageplus as I <EOL> class TestImagePlus ( unittest . TestCase ) : <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> from cellprofiler . modules . tests import example_images_directory , maybe_download_sbs <EOL> maybe_download_sbs ( ) <EOL> cls . root_dir = example_images_directory ( ) <EOL> J . attach ( ) <EOL> @ classmethod <EOL> def tearDownClass ( cls ) : <EOL> J . detach ( ) <EOL> def test_01_01_load_imageplus ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> self . assertTrue ( ip . getHeight ( ) > <NUM_LIT:0> ) <EOL> def test_01_02_get_id ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> ip . getID ( ) <EOL> def test_01_03_lock_and_unlock ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> self . assertTrue ( ip . lockSilently ( ) ) <EOL> try : <EOL> self . assertFalse ( ip . lockSilently ( ) ) <EOL> finally : <EOL> ip . unlock ( ) <EOL> def test_01_04_get_bit_depth ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> self . assertEqual ( ip . getBitDepth ( ) , <NUM_LIT:8> ) <EOL> def test_01_05_get_bytes_per_pixel ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> self . assertEqual ( ip . getBytesPerPixel ( ) , <NUM_LIT:1> ) <EOL> def test_01_06_get_channel ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> self . assertEqual ( ip . getChannel ( ) , <NUM_LIT:1> ) <EOL> def test_01_07_get_current_slice ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> self . assertEqual ( ip . getCurrentSlice ( ) , <NUM_LIT:1> ) <EOL> def test_01_08_get_width ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> target = load_image ( file_name ) <EOL> self . assertEqual ( ip . getWidth ( ) , target . shape [ <NUM_LIT:1> ] ) <EOL> def test_01_08_get_height ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> target = load_image ( file_name ) <EOL> self . assertEqual ( ip . getHeight ( ) , target . shape [ <NUM_LIT:0> ] ) <EOL> def test_01_09_get_nframes ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> self . assertEqual ( ip . getNFrames ( ) , <NUM_LIT:1> ) <EOL> def test_01_10_get_nslices ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> self . assertEqual ( ip . getNSlices ( ) , <NUM_LIT:1> ) <EOL> def test_01_11_get_n_dimensions ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> self . assertEqual ( ip . getNDimensions ( ) , <NUM_LIT:2> ) <EOL> def test_01_12_get_dimensions ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> dims = J . get_env ( ) . get_int_array_elements ( ip . getDimensions ( ) ) <EOL> width , height , nChannels , nSlices , nFrames = dims <EOL> self . assertEqual ( width , ip . getWidth ( ) ) <EOL> self . assertEqual ( height , ip . getHeight ( ) ) <EOL> self . assertEqual ( nChannels , ip . getNChannels ( ) ) <EOL> self . assertEqual ( nSlices , ip . getNSlices ( ) ) <EOL> self . assertEqual ( nFrames , ip . getNFrames ( ) ) <EOL> def test_01_13_get_channel_processor ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> p = ip . getChannelProcessor ( ) <EOL> self . assertTrue ( J . to_string ( p ) . startswith ( "<STR_LIT>" ) ) <EOL> def test_01_14_get_processor ( self ) : <EOL> file_name = os . path . join ( <EOL> self . root_dir , "<STR_LIT>" , "<STR_LIT>" ) <EOL> ip = I . load_imageplus ( file_name ) <EOL> p = ip . getProcessor ( ) <EOL> self . assertTrue ( J . to_string ( p ) . startswith ( "<STR_LIT>" ) ) </s>
