The 2D registration results are dark

Aperta
#409 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
data

Direzione di ricerca

The suspect is img_to_single_component, which converts the input with img.convert('P') (palette mode) before ants.from_numpy, so the array holds palette indices rather than intensities. Also check the randome_seed typo in the ants.registration call. Reproduce with two small 2D grayscale images, comparing mode 'P' against 'L' or 'F', then confirm the warped output is no longer dark. Done means a documented explanation of the input-mode requirement, or a fix that makes the output match the intensities of the inputs.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug
Hi, I was using ANTsPy to register 2D images, but I got 2 dark image as warped result and inverse warped result, I don't understand what's going on.

To Reproduce
My code to register the images is as follow:

def img_to_single_component(name):
    img = Image.open(name)
    # img = img.resize((1080, 1080))
    img = img.convert('P')
    img1 = ants.from_numpy(np.array(img))
    return img1
def antsRegistration(fi_path, mv_path, method, random_seed):
    fi = img_to_single_component(fi_path)
    mi = img_to_single_component(mv_path)
    mytx = ants.registration(fixed=fi, moving=mi, type_of_transform=method, randome_seed=random_seed)
    my_warped_image = ants.apply_transforms(fixed=fi, moving=mi, transformlist=mytx['fwdtransforms'],interpolator='nearestNeighbor')
    my_inversed_warped_image = ants.apply_transforms(fixed=mi, moving=fi, transformlist=mytx['invtransforms'],interpolator='nearestNeighbor')
    imageio.imwrite(f'{method}_Warped.png', my_warped_image.numpy())
    imageio.imwrite(f'{method}_InverseWarped.png', my_inversed_warped_image.numpy())

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
Affine_Warped
This is the warped image I get, the method is "Affine" and the interpolation is set to be "nearestNeighbor"

Desktop (please complete the following information):

  • OS: Windows 10 Pro 64
Lingua principale
Python
Stelle
891
Fork
180
Merge medio
1g 56m
PR unite (30g)
20

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ANTsX/ANTsPy

Tutte le issue di ANTsX/ANTsPy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.