tractatus / wholebrain

R package for segmentation, registration and generating web-based brain atlases from microscope images
GNU General Public License v3.0
83 stars 42 forks source link

Registration error #21

Closed epilepneuro closed 5 years ago

epilepneuro commented 5 years ago

Hello Daniel,

I am trying to process a single image to then translate to the multiple section pipeline, outlined on your website. I can segment the image without issue; however, when registering, the output image is completely white with a black background and I get the following error and warnings:

OUTPUT SEGMENTED CELLS: 2198
> regi<-registration(folder, coordinate=-1.79, filter=seg$filter)
output_10.29B4B5-7-4-2-00028_s3c2_ORG folder created
output_10.29B4B5-7-4-2-00028_s3c2_ORG does not exist
Loading image:C:/Users/Rotenberg/Desktop/Condition A/2PV/10.29B4B5-7-4-2-00028_s3c2_ORG.tif
====== LOADING DONE ======
Resizing to: 0.0256% of original size.
Image type: CV_16U_2
Plate 72 out of 132 
Saved as: C:\Users\ROTENB~1\AppData\Local\Temp\RtmpYZfSCZ/100960236.tif 
Loading image:C:\Users\ROTENB~1\AppData\Local\Temp\RtmpYZfSCZ/100960236.tif
====== LOADING DONE ======
Resizing to: 1% of original size.
Image type: CV_8UC3_16
Image type: CV_8U_0
Loading image:C:/Users/Rotenberg/Desktop/Condition A/2PV/10.29B4B5-7-4-2-00028_s3c2_ORG.tif
Error in transformationgrid$mx[index] : 
  negative values are not allowed in a matrix subscript
In addition: There were 27 warnings (use warnings() to see them)
> warnings()
Warning messages:
1: In rbind(coordinates, getIntersection(line, contour[indexExtrapolate[i,  ... :
  number of columns of result is not a multiple of vector length (arg 2)
2: In rbind(coordinates, getIntersection(line, contour[indexExtrapolate[i,  ... :
  number of columns of result is not a multiple of vector length (arg 2)
3: In rbind(coordinates, getIntersection(line, contour[indexExtrapolate[i,  ... :
  number of columns of result is not a multiple of vector length (arg 2)
4: In rbind(coordinates, getIntersection(line, contour[indexExtrapolate[i,  ... :
  number of columns of result is not a multiple of vector length (arg 2)
5: In rbind(coordinates, getIntersection(line, contour[indexExtrapolate[i,  ... :
  number of columns of result is not a multiple of vector length (arg 2)

Let me know what I should change,

Thanks!

tractatus commented 5 years ago

@epilepneuro could you post the output of:

seg$filter$resize

Most likely this number is too small which results in the atlas getting transformed outside of your image area.

epilepneuro commented 5 years ago

[1] 0.0256

The resize filter is currently at 386-2500

Edit: fixed it thank you

tractatus commented 5 years ago

Yes increasing it to something so the brain outline will fit into your image is desirable but you dont want to increase it so the atlas becomes too tiny. Try increasing it until you see that the brain outline drawn ontop of your image is just inside your brain section that normally gives good performance.

seg$filter$resize <- 0.05

or even:

seg$filter$resize <- 0.1

Depending on the size of your image.

tractatus commented 5 years ago

@epilepneuro did this solve i for you? can I close this issue?

epilepneuro commented 5 years ago

@tractatus Yes i believe it did thank you!