Giter Club home page Giter Club logo

imaris_extensions's Introduction

SimpleITK Imaris Extensions

Code style: black    ubuntu / macos / windows (Python 3.7, 3.10)   https://niaid.github.io/imaris_extensions/

This repository contains extensions, plugins, for the Imaris (Oxford Instruments) microscopy image analysis program. They either provide additional image analysis capabilities via the open source SimpleITK image analysis library, or are utilities that allow the user to easily modify meta-data associated with images stored in the Imaris file format (e.g. channel names, colors).

The extensions are designed so that they can be run either as independent programs or via the Imaris extension mechanism. When run as independent programs they can be used on any of the standard operating systems (Windows/OSX/Linux).

Software development notes:

  1. We use the black code formatter to ensure uniform code style.
  2. The code is tested on Linux/OSX/Windows with Python versions 3.7 and 3.10.
  3. As the testing data is rather large, we use git-lfs. To obtain the data using standard git commands you will have to install git-lfs on your system.
  4. Details on how to contribute can be found here.

Downloading and Updating

  1. Using zip file: Download the zip file for a specific release or the latest code's zip file. Replace older versions with the contents of the zip file (don't forget to keep the run_extensions.bat, run_extensions.sh files which you previously modified for your setup).
  2. Using git: Initially, clone repository using git (with GitHub account).
    git clone https://github.com/niaid/imaris_extensions.git
    
    Update to latest code:
    git pull
    
  3. If updating, you will want to remove or rename the existing Python environment:
    conda remove -n imaris --all
    
    or
    conda rename -n imaris  old_imaris
    

Then, recreate the imaris environment, step 2 in the setup instructions below.

How to Cite

If you find these extensions useful in your research, support our efforts by citing it as:

Z. Yaniv, B. Lowekamp, "SimpleITK Imaris Extensions", doi: 10.5281/zenodo.7854019.

Extensions Listing


WARNINGS

Avoid converting files into imaris format using a network or external drive, this has the potential to produce corrupt files that are hard to identify as such (unless you enjoy hours of debugging). This issue is not specific to the work found here. For more details see the XTRegisterSameChannel documentation.

Corrupt files will cause the extensions to fail with an error message "...OSError: Can't read data (inflate() failed)". In some cases imaris is able to read such files while the extensions fail to do so. A solution, that often works, is to read the file into imaris and then "Save as" to a new file which can then be read by the extensions.

Out of memory errors will cause the extensions to fail with an error message along the lines of "...Failed to allocate memory for image.". The minimal RAM size required to run an extension depends on the image sizes and the specific extension in use. For common image sizes, 16GB of RAM is often sufficient, 64GB or more is desirable. If memory size is not sufficient, consider increasing the size of the machine's virtual memory. Experience has shown us that some extensions, e.g. XTChannelArithmetic, do work on systems with only 8GB of RAM when configured appropriately (using a memory efficient slice-by-slice processing at the cost of longer runtimes).


Algorithms

  1. XTRegisterSameChannel - Registration of 2D or 3D images that share a common channel (correlation based affine alignment). Sample datasets are freely available on zenodo DOI. A video illustrating the usage of the extension is available on YouTube.
  2. XTChannelArithmetic - Perform channel arithmetic, and more advanced channel manipulations via short SimpleITK expressions (short SimpleITK programs).
  3. XTVirtualHEStain - Create a virtual H&E stain from a fluoresence image and add the RGB image as three new channels to the original image.
  4. More to come.

Utilities

  1. XTConfigureChannelSettings - Configure channel settings, name, description and visualization configuration specified via a csv file or an Imaris file.
  2. XTExportChannelSettings - Export channel settings, name, description and visualization configuration to a csv file. The resulting csv file can be easily edited and then applied to other imaris files using the XTConfigureChannelSettings extension.
  3. More to come.

Setup

  1. Install a Python version. The specific Python version you need depends on your version of Imaris (for us this is Python 3.7.0). Running the extensions as independent programs is less restrictive, requiring the use of Python version 3.6 or above.[Miniconda download].
  2. Configure and install the required Python packages.
  • On Windows: open the Anaconda Prompt (found under the Anaconda3 start menu).
  • On Linux/OSX: on the command line source path_to_your_anaconda3/bin/activate base
  cd path_to_your_extensions_directory
  conda env create -f environment.yml
  1. Configure Imaris to point to your Python executable and to the directory containing the extensions (see Imaris manual).
    Note: this is an optional step, if you don't have the Imaris software on the specific machine you can still run the extensions.

  2. Edit one of these files, set the path to your Python executable:
    Windows: run_extensions.bat
    OSX/Linux: run_extensions.sh

  3. Run the relevant script:

    Windows: double click the run_extensions.bat.

    OSX/Linux: from a terminal, make the script executable chmod +x run_extensions.sh and run it ./run_extensions.sh.

    Bonus: On OSX, you can configure things so that double clicking the script in Finder will run it. In Finder,

    1. Right-click the run_extensions.sh file and select "Open with" and then "Other..."
    2. Change the "Enable" dropdown menu from "Recommended Applications" to "All Applications".
    3. Search for "Terminal" and select it (check the "Always Open With" if you want all shell scripts to be run via terminal, otherwise leave it unchecked).

imaris_extensions's People

Contributors

blowekamp avatar dependabot[bot] avatar zivy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

zivy blowekamp

imaris_extensions's Issues

Installing and using Channel Arithmetic in Imaris

Hi there,
I have a very naïve question here. I am trying to set up imaris_extensions (particularly interested in channel Arithmetic). I have followed the steps mentioned in the set up guide; installed Python 3.7, created the environment, configure imaris to point to python executable and the directory including the extensions. When I attempt to run 'run_extensions.bat', I receive the following code. When I press a key, it just closes the command prompt. I am not sure what I am doing wrong or not doing at all. I would appreciate any help in setting up this extension.

Thank you and sorry about the basic question.

C:\Program Files\Bitplane\Imaris 10.1.1\XT\python3\imaris_extensions-main>REM Provide the full path to the activate batch script.

C:\Program Files\Bitplane\Imaris 10.1.1\XT\python3\imaris_extensions-main>REM Path is in quotation marks to accommodate for spaces in

C:\Program Files\Bitplane\Imaris 10.1.1\XT\python3\imaris_extensions-main>REM directory names.

C:\Program Files\Bitplane\Imaris 10.1.1\XT\python3\imaris_extensions-main>REM Need to use 'call' because this is a batch file invoked

C:\Program Files\Bitplane\Imaris 10.1.1\XT\python3\imaris_extensions-main>REM from this batch file. Need to activate explicitly as this

C:\Program Files\Bitplane\Imaris 10.1.1\XT\python3\imaris_extensions-main>REM places the appropriate DLLs in the path.

C:\Program Files\Bitplane\Imaris 10.1.1\XT\python3\imaris_extensions-main>call "F:\toolkits\Anaconda3\Scripts\activate" imaris
'"F:\toolkits\Anaconda3\Scripts\activate"' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\Bitplane\Imaris 10.1.1\XT\python3\imaris_extensions-main>python ExtensionDriver.py
Traceback (most recent call last):
File "ExtensionDriver.py", line 25, in
from PySide6.QtWidgets import QApplication, QLabel, QMainWindow
ModuleNotFoundError: No module named 'PySide6'

C:\Program Files\Bitplane\Imaris 10.1.1\XT\python3\imaris_extensions-main>pause
Press any key to continue . . .

warning generated on windows

Following warning is generated when extension was run on a windows command line:

C:\Users\xlab\miniconda3\envs\imaris\lib\site-packages\qtpy\__init__.py:202: RuntimeWarning: Selected binding "pyside2" could not be found, using "pyqt5"
  'using "{}"'.format(initial_api, API), RuntimeWarning)

question about installing the latest version of the Ibex analysis extension

Dear authors,
I encountered error msgs when installing the software recently. I just installed the standalone version. no matter using python or anaconda, it seems to have the same error during installation of not finding visual studio with note: This error originates from a subprocess, and is not likely not a problem with pip. ”, ERROR: failed building wheel for SimpleITK; Error: could not build wheels for SimpleITK, which is required to install pyproject.toml-based projects.

Would you pls give me some suggestions on that? thanks a lot!

I successfully installed the software last year with Python pip.

Best, Yu

problem with stand along version after building in anaconda

We have tried to build the imaris environment using anaconda on windows. The build goes without issues and the extension window will pop up. However, when we try to select the drop down menu, the following error comes up.

QWindowsWindow::setMouseGrabEnabled: Not setting mouse grab for invisible window QWidgetWindow/'QMenuClassWindow'

Issue with XTRegisterSameChannel.py

Hi!

Thank you first for your cool work and the tremendous effort for the user-friendly GUI and great documentation.

I ran into no issues when using the XTRegisterSameChannel.py extension until the 'Resample And Save Combined Image' step. Please find the error message below. I was wondering if you ever encounter a similar issue before and perhaps know the solution? Thank you very much!

Exception occurred during computation:
Traceback (most recent call last):
File "C:\Users\BIF users_New\Downloads\imaris_extensions-main\imaris_extensions-main\XTRegisterSameChannel.py", line 1184, in run
sio.write(resampled_image, self.output_file_name)
File "C:\Users\BIF users_New\Downloads\imaris_extensions-main\imaris_extensions-main\sitk_ims_file_io.py", line 1026, in write
_write_channel_histogram(grp, channel_arr_view, channel.GetPixelID())
File "C:\Users\BIF users_New\Downloads\imaris_extensions-main\imaris_extensions-main\sitk_ims_file_io.py", line 1061, in _write_channel_histogram
compression_opts=2,
File "C:\ProgramData\Anaconda3\envs\imaris\lib\site-packages\h5py_hl\group.py", line 148, in create_dataset
dsid = dataset.make_new_dset(group, shape, dtype, data, name, **kwds)
File "C:\ProgramData\Anaconda3\envs\imaris\lib\site-packages\h5py_hl\dataset.py", line 137, in make_new_dset
dset_id = h5d.create(parent.id, name, tid, sid, dcpl=dcpl)
File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5d.pyx", line 87, in h5py.h5d.create
ValueError: Unable to create dataset (name already exists)

Best,
Lynn

alignment issues

Hello,
I am facing a problem with ITK alignment . More specifically, when I upload my images the outpout score before alignment is usually 0,05 to 0,1 after the registration the highest score that I got is 0.7 (after cropping etc). But , when I am observing my images I can clearly see that there is no problem with my registration markers or any tissue drifting so the final score makes no sense (neiher the initial). I would like to know if there is a setting that I can play with to bring my images closer and obtain a better alignment score after registraton

Thanks a lot in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.