Results 1 to 8 of 8

Thread: Perform image processing of a scene during image acquisition of the next scene

  1. #1
    Junior Member
    Join Date
    Apr 2018
    Posts
    11

    Perform image processing of a scene during image acquisition of the next scene

    Hi,

    We have recently acquired a Zeiss LSM800 that we are using to image cells in
    96-well plates. In each well, we need to scan a large region and acquire a
    z-stack, so we use the tiles option to automate this. Imaging and entire plate
    this way can take around 10 hours, and after that we need to perform a MIP for
    each z-stack, stitch the tiles together, and export the images as TIFFs, which can
    add another 3-4 hours after the imaging of the plate is complete.

    It would be much more efficient if the MIP, stitch, and TIFF export could be
    performed on each well individually *while* the instrument continues to image
    the next well. For example, after the instrument has completed imaging of the
    entire tile region in well A1 (scene 1), it moves on to imaging A2 (scene 2)
    while the tile images from A1 are being processed (MIP, stitch, export) in the
    background. Is this possible?

    To clarify, I already have a macro to do the MIP, stitch, export after all
    wells are finished, but how can I make this run on each well/scene
    automatically while the instrument keeps imaging the next well/scene? I would
    prefer to keep the original image as one large .czi, but if the only way to
    achieve what I describe is to split it into smaller .czi-files during
    acquisition, then that is also fine.

    Thanks for reading, any suggestions to point me in the right direction are most
    appreciated!

  2. #2
    CZ Administrators Carl Zeiss Microscopy 3's Avatar
    Join Date
    Jan 2013
    Posts
    388
    Hello joelostblom,

    did you try

    Tiles / Options / Split Scenes into separate files

  3. #3
    Junior Member
    Join Date
    Apr 2018
    Posts
    11
    Thanks for the reply!
    I did try that option, but the macro is still run once after all images are collected, not after each well image is saved which is what I want. I guess I could make a macro that executes before the scan and watches the directory for new images but this sounds a bit cumbersome vs just having an option in the Zeiss Blue to execute the macro as soon as the first image is saved. Is there nothing in the OAD or Zen blue GUI that can help me achieve this?

  4. #4
    Junior Member
    Join Date
    Apr 2018
    Posts
    11
    If it is the case that I have to run a macro beforehand and watch a directory for new files to be saved, could you please advice on how I can do this in the Zeiss IronPython environment? I tried briefly with the multiprocessing module, but I run into errors that I believe are related to that the scripts are not running with the 'main' namespace, but rather imported as module (error message posted below).

    Code:
    System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
       at System.Xml.XmlTextReaderImpl.Throw(Exception e)
       at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
       at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
       at Zeiss.Micro.XPersistableExtensions.LoadFromXmlFile(Action`1 parseXml, String fileName)
       at Zeiss.Micro.XPersistableExtensions.LoadFromXmlFile[T](T persistableObject, String fileName)
       at Zeiss.Micro.Document.DocumentBase.Open(String fileName, Boolean readOnly)
       at Zeiss.Micro.ScriptEditor.Scripting.ScriptEditorService.FindOrOpen(String macroName)
       at Zeiss.Micro.ScriptEditor.ViewModels.ScriptEditViewModel.ShowErrorMessage(IScriptErrorMessage errorMessage)
       at FastSmartWeakEvent(WeakReference , Object , ErrorEventArguments )
       at Zeiss.Micro.WeakEventSource`2.Raise(Object sender, TEventArgs e)
       at Zeiss.Micro.ScriptEditor.ViewModels.ScriptEditViewModel.ExecuteScript(ScriptEditorDocumentBase script, RuntimeAction runtimeAction)
       at Zeiss.Micro.ScriptEditor.ViewModels.ScriptIDEViewModel.Execute(Object parameter)
       at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
       at System.Windows.Controls.Primitives.ButtonBase.OnClick()
       at System.Windows.Controls.Button.OnClick()
       at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
       at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
       at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
       at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

  5. #5
    Junior Member
    Join Date
    Apr 2018
    Posts
    11
    Also, if I want to fork a process into the background, what is the path to the Zeiss IronPython executable? I can only find the anaconda python 3.6 within the Zeiss folders and a dll for python 2.7, but not the ironpython executable.

  6. #6
    CZ Administrators Carl Zeiss Microscopy 3's Avatar
    Join Date
    Jan 2013
    Posts
    388
    Hello joelostblom,

    what you want to do is 'parallel processing' during acquisition.

    We invested a lot of efforts to get a sequential program flow in the python environment of ZEN.
    An asynchronous program flow is much harder to handle and therefore not suitable for most of our customers.

    Therefore the only way to do the 'parallel processing' in the macro environment is to have a separate pc with a ZEN desk/lite installed plus a network share on the drive where the acquisition puts its images.
    In other words: The main pc does the acquisition (with split scenes) and the images are stored in a certain folder. The second pc has ZEN desk/lite and a macro is running that watches via network share the folder and finally commits the calculations necessary.

    A Zen desk (without macro environment license) can run macros and has access to the basic functions of ZEN. For only stitching and export ZEN lite might be enough. ZEN desk and lite can be extended by additional modules.

    For further details please contact your local sales representative!

  7. #7
    Junior Member
    Join Date
    Apr 2018
    Posts
    11
    Thanks for the reply,
    Before I try with a second machine, I have a couple of questions:

    1. Is it possible to launch the IronPython that Zen uses without starting Zen? Is there an executable in one of the Zeiss folders for the IronPython console? If so, what is the path, I could not find it.

    2. Is it possible to install the Zeiss python module in any Python environment? Can I download Pyton 2.7 via anaconda and import the Zeiss modules somehow (as long as Zen is installed on the computer)?

  8. #8
    CZ Administrators Carl Zeiss Microscopy 3's Avatar
    Join Date
    Jan 2013
    Posts
    388
    1. Is it possible to launch the IronPython that Zen uses without starting Zen?
    No, the IronPython macro environment of ZEN is pretty much linked to ZEN and therefore expects to run within ZEN.

    2. Is it possible to install the Zeiss python module in any Python environment?
    No, we just can use IronPython as ZEN is programmed in .Net, which ist mageged code.
    'Any Python environment' is usually ‘normal Python’, which is unmanaged code.
    Unless you invest a lot of time managed and unmanaged code do not match.
    And again, you need a running ZEN, as Experiment.Execute so to speak ‘clicks’ the ‘Start Experiment' button in the GUI.
    Last, but not least, you have singed in the contract with ZEISS that you will not do things like that ;-)

    The good news is that the COM interface might be an option for you.
    There are a couple of examples in this forum. This lets you handle a running ZEN from a standard Python environment or any other unmanaged code like C++. You should be familiar with the COM technology and its pros and cons. But keep in mind that this approach is also sequential and has not the full potential of the OAD-Macro-Environment, but it might work for your needs.

    At the end I just want to point out that any tricks to do parallel things with a single running ZEN might work in some situations or just slow your system down. But it also might crash, harm your system or prepared slides as the environment is neither designed nor tested to do that!
    Last edited by Carl Zeiss Microscopy 3; 12-13-2018 at 10:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •