Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Aligning Channel in CyCIF Images #232

Open
cqqa0623 opened this issue Nov 27, 2024 · 3 comments
Open

Issue with Aligning Channel in CyCIF Images #232

cqqa0623 opened this issue Nov 27, 2024 · 3 comments

Comments

@cqqa0623
Copy link

Dear all,

I have a set of CyCIF images, and I am consistently unable to align the DNA channel. This is one of the sets I’m working with.
https://we.tl/t-ayTVDI9xbd

ashlar IF1-A-01_F0002_T0001_Z0001.tif IF2-A-01_F0002_T0001_Z0001.tif IF3-A-01_F0002_T0001_Z0001.tif IF4-A-01_F0002_T0001_Z0001.tif IF5-A-01_F0002_T0001_Z0001.tif -c 2

Snipaste_2024-11-27_23-49-40

And another question I'd like to ask is that : some of my images are rectangular, and I’m unsure if this non-square aspect is causing the alignment issue. Can Ashlar align non-square IF images? I attempted to make these rectangular images square using ImageJ, but after merging them in Ashlar, I still can't get them to align properly. I would appreciate any guidance or suggestions on how to resolve this issue.

Thank you so much!

@cqqa0623
Copy link
Author

And the following is the metadata of the imaging result :
<icm:ImagingResult xmlns:icm="http://www.yokogawa.co.jp/LSC/ICMSchema/1.0" icm:StructVersion="2.0">
<icm:FileInformation icm:Name="ImagingResult.xml" icm:Version="1.0" icm:CreateTime="2023-10-23T14:02:03.6604906+02:00" icm:CreateUser="CQ1" icm:LastUpdateTime="2023-10-23T14:32:44.882064+02:00" icm:LastUpdateUser="CQ1"/>
<icm:ResultInfo icm:BeginTime="2023-10-23T14:02:03.5245518+02:00" icm:EndTime="2023-10-23T14:32:44.5224373+02:00" icm:Result="Completed">
icm:ProtocolPathMeasurementProtocol.xml</icm:ProtocolPath>
</icm:ResultInfo>
<icm:MachineInfo icm:ProductID="X6CQ001" icm:SerialNumber="90X801630" icm:FirmwareVersion="1.03.02.00" icm:AutoFocusRevision="3"/>
<icm:ImageDataInfo icm:FolderDividingMethod="None" icm:IsFlatFieldCalibration="true" icm:IsGeometricCalibration="true" icm:LastTimePoint="1" icm:TotalTimePoint="1">
icm:DimensionsInfo
<icm:W icm:Min="1" icm:Max="1"/>
<icm:A icm:Min="1" icm:Max="13"/>
<icm:F icm:Min="1" icm:Max="45"/>
<icm:T icm:Min="1" icm:Max="1"/>
<icm:Z icm:Min="1" icm:Max="20"/>
<icm:C icm:Min="1" icm:Max="5"/>
</icm:DimensionsInfo>
<icm:EnableArea icm:X="10" icm:Y="10" icm:Width="1980" icm:Height="1980"/>
<icm:ImageCompressParameter icm:IsImageCompress="false" icm:ImageCompressType="Lzw"/>
</icm:ImageDataInfo>
icm:ChannelInfoList
<icm:ChannelInfo icm:Ch="1" icm:HorizontalPixelSize="0.1625" icm:VerticalPixelSize="0.1625" icm:PixelWidth="2000" icm:PixelHeight="2000" icm:CameraNumber="1" icm:FilterWheelIndex="1" icm:FilterWheelPosition="1" icm:StitchROITopLeftX="150" icm:StitchROITopLeftY="150" icm:StitchROIWidth="1700" icm:StitchROIHeight="1700"/>
<icm:ChannelInfo icm:Ch="2" icm:HorizontalPixelSize="0.1625" icm:VerticalPixelSize="0.1625" icm:PixelWidth="2000" icm:PixelHeight="2000" icm:CameraNumber="1" icm:FilterWheelIndex="1" icm:FilterWheelPosition="2" icm:StitchROITopLeftX="150" icm:StitchROITopLeftY="150" icm:StitchROIWidth="1700" icm:StitchROIHeight="1700"/>
<icm:ChannelInfo icm:Ch="3" icm:HorizontalPixelSize="0.1625" icm:VerticalPixelSize="0.1625" icm:PixelWidth="2000" icm:PixelHeight="2000" icm:CameraNumber="1" icm:FilterWheelIndex="1" icm:FilterWheelPosition="3" icm:StitchROITopLeftX="150" icm:StitchROITopLeftY="150" icm:StitchROIWidth="1700" icm:StitchROIHeight="1700"/>
<icm:ChannelInfo icm:Ch="4" icm:HorizontalPixelSize="0.1625" icm:VerticalPixelSize="0.1625" icm:PixelWidth="2000" icm:PixelHeight="2000" icm:CameraNumber="1" icm:FilterWheelIndex="1" icm:FilterWheelPosition="4" icm:StitchROITopLeftX="150" icm:StitchROITopLeftY="150" icm:StitchROIWidth="1700" icm:StitchROIHeight="1700"/>
<icm:ChannelInfo icm:Ch="5" icm:HorizontalPixelSize="0.1625" icm:VerticalPixelSize="0.1625" icm:PixelWidth="2000" icm:PixelHeight="2000" icm:CameraNumber="1" icm:FilterWheelIndex="1" icm:FilterWheelPosition="10" icm:StitchROITopLeftX="150" icm:StitchROITopLeftY="150" icm:StitchROIWidth="1700" icm:StitchROIHeight="1700"/>
</icm:ChannelInfoList>
icm:CameraApertureResults
<icm:StitchParameter icm:IsStitchEnabled="true" icm:IsWritingStitchedImageEnabled="false" icm:NaX="85" icm:NaY="85"/>
<icm:CameraApertureResult icm:CameraNumber="1" icm:ApertureHorizontalPixels="1700" icm:ApertureVerticalPixels="1700" icm:HorizontalPixels="2000" icm:VerticalPixels="2000"/>
</icm:CameraApertureResults>
icm:CalibrationInfoList
<icm:ChannelCalibrationInfo icm:Ch="1" icm:DarkPath="Calibration\DC_ORCA_Flash_40 S.No.304710_Bin1_Exp 100ms_Gain 16-bit (full resolution, standard scan).tif" icm:ShadingPath="Calibration\SC_405nm ORCA_Flash_40_UPLXAPO40X.tif" icm:CameraPrameterKey="Port1,sCMOS 2000 x 2000,ORCA_Flash_40,S.No.304710," icm:ObjectLensName="UPLXAPO40X" icm:MagnificationCalibrateRatio="1.0048" icm:BaseIntensityOffset="101"/>
<icm:ChannelCalibrationInfo icm:Ch="2" icm:DarkPath="Calibration\DC_ORCA_Flash_40 S.No.304710_Bin1_Exp 100ms_Gain 16-bit (full resolution, standard scan).tif" icm:ShadingPath="Calibration\SC_488nm ORCA_Flash_40_UPLXAPO40X.tif" icm:CameraPrameterKey="Port1,sCMOS 2000 x 2000,ORCA_Flash_40,S.No.304710," icm:ObjectLensName="UPLXAPO40X" icm:MagnificationCalibrateRatio="1.0048" icm:BaseIntensityOffset="101"/>
<icm:ChannelCalibrationInfo icm:Ch="3" icm:DarkPath="Calibration\DC_ORCA_Flash_40 S.No.304710_Bin1_Exp 100ms_Gain 16-bit (full resolution, standard scan).tif" icm:ShadingPath="Calibration\SC_561nm ORCA_Flash_40_UPLXAPO40X.tif" icm:CameraPrameterKey="Port1,sCMOS 2000 x 2000,ORCA_Flash_40,S.No.304710," icm:ObjectLensName="UPLXAPO40X" icm:MagnificationCalibrateRatio="1.0048" icm:BaseIntensityOffset="101"/>
<icm:ChannelCalibrationInfo icm:Ch="4" icm:DarkPath="Calibration\DC_ORCA_Flash_40 S.No.304710_Bin1_Exp 100ms_Gain 16-bit (full resolution, standard scan).tif" icm:ShadingPath="Calibration\SC_640nm ORCA_Flash_40_UPLXAPO40X.tif" icm:CameraPrameterKey="Port1,sCMOS 2000 x 2000,ORCA_Flash_40,S.No.304710," icm:ObjectLensName="UPLXAPO40X" icm:MagnificationCalibrateRatio="1.0048" icm:BaseIntensityOffset="101"/>
<icm:ChannelCalibrationInfo icm:Ch="5" icm:DarkPath="Calibration\DC_ORCA_Flash_40 S.No.304710_Bin1_Exp 100ms_Gain 16-bit (full resolution, standard scan).tif" icm:ShadingPath="" icm:CameraPrameterKey="Port1,sCMOS 2000 x 2000,ORCA_Flash_40,S.No.304710," icm:ObjectLensName="UPLXAPO40X" icm:MagnificationCalibrateRatio="1.0048" icm:BaseIntensityOffset="101"/>
</icm:CalibrationInfoList>
<icm:AnalysisPath icm:Name="MeasurementProtocol"/>
<icm:MapParameter icm:MapViewUISize="1600" icm:MapViewUIMinShowSize="400" icm:MapMargin="0" icm:UseOffsetToMapRestricted="true"/>
<icm:SaveImageFileInfo icm:Slice="true" icm:MIP="true" icm:SUM="true"/>
</icm:ImagingResult>

@jmuhlich
Copy link
Collaborator

You do not need square images -- rectangular images work just fine.

I think you are facing two problems with your images:

  1. Ashlar always aligns all cycles to the first cycle. Your IF1 image does not really look like the cells are exactly the same as the others, and in fact the others are all a little different from each other too (but not as much as IF1). I suspect these are confocal images taken at slightly different focal depths, so the elongated cells appear to "move" as the focal depth changes. Since IF1 is so different from the rest, ashlar can't align them very well to it. I got much better results reversing the order (5 4 3 2 1) so ashlar starts with IF5 and and aligns the others to that. IF1 is too different to align using the pixel-based rigid registration method in ashlar so it's always going to be off, and I don't think it's recoverable. Ideally your microscope would let you record the auto-focus height from the first scan and reuse it for the other cycles, but I suppose some software doesn't offer this feature.
  2. The images are a bit noisy (not surprising for confocal) which causes trouble for ashlar. Add --filter-sigma 1 to apply a light gaussian blur during stitching to account for this.

Here is the result I got by changing just those two things. You can see how much the cell cluster in IF1 (dark blue) differs in shape from the other four cycles, which align moderately well (as well as rigid registration can do given the focus depth issue).
image

@cqqa0623
Copy link
Author

cqqa0623 commented Dec 3, 2024

Thank you for your help! Reversing the alignment order in Ashlar (starting from IF5) indeed made a significant improvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants