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

Error in the ***LOAD AND ENCODE LABEL IMAGE VECTORS*** step #13

Open
gtrancourt opened this issue May 18, 2018 · 3 comments
Open

Error in the ***LOAD AND ENCODE LABEL IMAGE VECTORS*** step #13

gtrancourt opened this issue May 18, 2018 · 3 comments

Comments

@gtrancourt
Copy link
Collaborator

I got this error in the Read from file mode. I looked up the lines but have no idea what's happening.

***LOAD AND ENCODE LABEL IMAGE VECTORS***
Traceback (most recent call last):
  File "MLmicroCT.py", line 1328, in <module>
    main()
  File "MLmicroCT.py", line 1280, in main
    rf_transverse,FL_train,FL_test,Label_train,Label_test = train_model(gridrec_stack,phaserec_stack,label_stack,localthick_stack,gridphase_train_slices_subset,gridphase_test_slices_subset,label_train_slices_subset,label_test_slices_subset)
  File "MLmicroCT.py", line 709, in train_model
    Label_test = LoadLabelData(ls, label_test, "transverse")
  File "MLmicroCT.py", line 665, in LoadLabelData
    labelimg_in_rot_sub = labelimg_in_rot[sub_slices,:,:]
IndexError: index 12 is out of bounds for axis 0 with size 12
@gtrancourt
Copy link
Collaborator Author

I think I got it. I indexed in a natural way of indexing and not in the python's way, i.e., 0 is the first element. Maybe it's worth adding a piece of code that detects if the index is out of bounds by 1 and if so, subtract 1 from all of the index values.

But I guess this error also means that the test and training slices should be indexed the python's way, which is not the ImageJ's way either. So two solutions: either ask for "natural" indexing (starting from 1) and then substract by 1 in python, or ask the user to input values already subtracted by 1.

@mattjenkins3
Copy link
Collaborator

Yes! I think I like your idea to detect if all label image indexes are greater than 0, and if so then subtracting 1 from each. I think it might be confusing to mentioned natural vs. python indexing in the instructions file and this solution would, in theory, account for all possible user error, right?

Thanks again. Will include this with next update.

@gtrancourt
Copy link
Collaborator Author

I like your approach, and it's a catch-all I feel.

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