Git Product home page Git Product logo

readimagejroi's People

Contributors

dylanmuir avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

readimagejroi's Issues

[ROIs2Regions.m] x-y swapped and unnecessary +1?

Hi Dylan
Thank you for your useful tools.

It seems ROIs2Regions.m have bugs around handling x-y coordinates.

I tried to visualize my ('freehand') ROI data with the code below.
But it shows "fragmented" ROIs.

cvsROI = ReadImageJROI('RoiSet.zip');
sRegions = ROIs2Regions(cvsROI , vnImageSize);
mnLabelMatrix = labelmatrix(sRegions);
imagesc(label2rgb(mnLabelMatrix));

I checked ROIs2Regions.m and found 2 points.


[1] x-y was wrongly swapped.

ROIs2Regions apply transpose (') to the mbThisMask.
That will cause swapping of x and y dimension.

   sRegions.PixelIdxList{nROIIndex} = find(mbThisMask');

So I think it should be removed.

   sRegions.PixelIdxList{nROIIndex} = find(mbThisMask);

With this change, the ROI shape in mnLabelMatrix looks correct.


[2] Unnecessary +1

Additional validation, I compared the result with the image manually output from ImageJ.
I applied "Fill" to background and ROI with two different colors.
For background: Edit > Fill
For ROI: ROI Manager > More > Fill

mnImageJBinary= imread('Sample_ImageJ_Binary.tif');
imshowpair(mnImageJBinary>0, mnLabelMatrix>0);

And found that there is a shift between 2 images.

I guess that the addition of "1" to mnCoordinates is not necessary.

mbThisMask = poly2mask(sThisROI.mnCoordinates(:, 1)+1, sThisROI.mnCoordinates(:, 2)+1, vnImageSize(1), vnImageSize(2));

So it should be like below.

mbThisMask = poly2mask(sThisROI.mnCoordinates(:, 1), sThisROI.mnCoordinates(:, 2), vnImageSize(1), vnImageSize(2));

With editing these 2 points, ROIs2Regions.m works well for "Freehand" ROI in my environment.
I did not check for other cases "rectangle", "oval", "polygon".

First of all, I want to know this is generally happening or caused by my environment or somehow my misunderstanding.

My environment for this issue is below.
Matlab: 2019a
ImageJ: 1.52v on Fiji

Best,
Gaku

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.