NEFM-TUDresden / MCRpy

Microstructure Characterization and Reconstruction in Python
Apache License 2.0
39 stars 14 forks source link

Attribute error #3

Closed olowu289 closed 1 year ago

olowu289 commented 1 year ago

Im working on the project, micro-structural reconstruction using machine learning and im using the MCRpy and I'm having this attribute error.

import mcrpy as mcr import numpy as np from PIL import Image

Load the image using Pillow

image = Image.open('/content/drive/MyDrive/AlubronzeCuAl20v500.png')

Convert the image to a NumPy array

slice_2d = np.array(image)

Define the size of the 3D volume element

size_3d = (100, 100, 100)

Define the descriptors to use

descriptors = [mcr.Descriptor.TwoPointCorrelationFFT()]

Reconstruct the 3D volume element

volume_3d = mcr.reconstruct(slice_2d, size_3d, descriptors)

the error AttributeError: module 'mcrpy' has no attribute 'Descriptor'

s5409693 commented 1 year ago

In the step where you define the descriptors to use, the descriptors should be strings with the descriptor names descriptors = ["TwoPointCorrelationFFT"]

s5409693 commented 1 year ago

Hope this helps. In your example, you should also note that the reconstruction settings passed to mcrpy.reconstruct should be a mcrpy.ReconstructionSettings object with the appropriate attributes set. An example is given in the Readme file and the IMMJ Paper https://scholar.google.de/citations?view_op=view_citation&hl=de&user=2UzAz_sAAAAJ&citation_for_view=2UzAz_sAAAAJ:qjMakFHDy7sC