neuropoly / axonseg

Segment axon and myelin from microscopy data. Written in Matlab.
MIT License
19 stars 12 forks source link

Error using as_myelinseg2axonlist #50

Closed davidrs06 closed 6 years ago

davidrs06 commented 6 years ago

First of all thanks for providing the code for this tool, as well as the histological data, I'm looking forward to use it !

I tried to segment a test image provided in axonseg/code/data/test_image_OM.tifby running AxonSeg( 'test_image_OM.tif', 'SegParameters.mat', '-nogui' ).

Unfortunately, the script crashes after a few steps, with the following error message:

reading the image
Starting segmentation..
Loop over blocks of 2080 pixels (1 blocks in total) :
Processing block #1 over 1 blocks
Error using as_myelinseg2axonlist (line 26)
Index exceeds matrix dimensions.

Error in myelinInitialSegmention (line 10)
axonlist = as_myelinseg2axonlist(false(size(axonBW)),1);

Error in as_Segmentation (line 45)
    out = myelinInitialSegmention(im_in, AxSeg_rb,
    backBW,0,segParam.Regularize,2/3,0,segParam.PixelSize);

Error in as_Segmentation_full_image>@(x)as_Segmentation(x,SegParameters) (line 66)
    axonlist_cell=as_improc_blockwising(@(x)
    as_Segmentation(x,SegParameters),handles.data.img,blocksize,overlap,0);

Error in as_improc_blockwising>(parfor body) (line 51)
        im_cropProc=fun(imgcrop);

Error in as_improc_blockwising (line 27)
parfor(block=1:n_blocki*n_blockj,parforArg)

Error in as_Segmentation_full_image (line 66)
    axonlist_cell=as_improc_blockwising(@(x)
    as_Segmentation(x,SegParameters),handles.data.img,blocksize,overlap,0);

Error in AxonSeg (line 57)
        as_Segmentation_full_image(varargin{:})

When adding a breakpoint at line 6 in as_myelinseg2axonlist, it seems that the variable seg is made of zeroes only, which leads to an empty tmp variable at line 18 and triggers the error at line 26 when trying to run tmp(iaxon). I'm using MatlabR2014b on Mac OSX. The error also appears when trying the same command on a computer with Ubuntu and Matlab2017b. The same error also appears when using the GUI and clicking on "Segment myelin" for the non-cropped image.

Is there a way to fix this ?

Thanks in advance and best regards ! David Romascano

tanguyduval commented 6 years ago

@davidrs06 Thank you for your feedback.

This error is now solved in the last release https://github.com/neuropoly/axonseg/releases

Best, Tanguy

davidrs06 commented 6 years ago

Thank you for answering so fast @tanguyduval !

I've pulled the last commits, and also tried downloading the zip file to a new repository, but I keep getting the same error message :(

Do you know what might be the issue ? Am I doing something wrong ? From the last commit, it seems several files were deleted or emptied, but I can't see any change in the code that could change something regarding this issue... Have you seen this kind of error before ?

alzaia commented 6 years ago

Hello @davidrs06 , sorry about that.

I tested the exact function call you provided above with version 3.0 of the package (https://github.com/neuropoly/axonseg/releases/tag/v3.0) and it worked without any bugs. I think there might be an issue in our latest version. Can you use v3.0 instead, while I will investigate for the issue in the latest release?

Note that the segmentation of the test sample provided may take some time as it is quite large. If you want to do a smaller test, you can use a cropped version of that sample: https://www.dropbox.com/s/txp4sbhznh95ha3/test_image_OM_2.tif?dl=0

Thanks for the feedback!

tanguyduval commented 6 years ago

@alzaia I found the bug, there is a conflict between two versions of as_myelinseg2axonlist.m in the AxonSeg folder (one in code/Seg_myelin and one in code/MyelinSeg_processing ). @davidrs06 sorry I didn't have time to look at this today. We will push a fix tomorrow. Best, Tanguy

tanguyduval commented 6 years ago

@davidrs06 I pushed a new release that is correcting your bug.

Sorry, but this software does not have continuous testing and some problems can be introduced in some versions.

Best, Tanguy

PS: The project axondeepseg, that uses a deep learning approach, is more active. Please have a look if you are interested.

tanguyduval commented 6 years ago

@davidrs06 shall we close this issue? Please don't hesitate to post additional issues.

davidrs06 commented 6 years ago

Yes, the current version runs without errors, outputing the labeled images as expected, thanks a lot !

tanguyduval commented 6 years ago

Thank you, solved