Issues with New Module for Numpy Files

Hi, I am trying to work out a new extension that is capable of going into a directory and pulling out all npy or npz files and importing them into 3D slicer as a volume. I am positive that the radio button logic on my code needs work, but I am not sure how to continue. I have looked through multiple instances of other codes using these radiobuttons and have tried their syntax only for it to break my script (obviously this is a problem caused by a lack of knowledge about UI code and connecting the logic up right). Attached is my gist if there is anyone willing to take a look.

If you don’t want to immediately act on your radiobutton clicks then there is no need to connect any signals to them. In the onApply method you can get the state of the radiobutton like this:

isFormatNpy = self.FileTypeNPY.checked

Thanks for working on adding support for importing npy or npz files.

For convenience and to have it one-click away, the format is documented here: numpy.lib.format — NumPy v1.22 Manual

Thank you for your help. I have updated the script and it is working with numpy files as well as npz files. The last thing I wanted to do was to make it where the script was capable of creating a listing of all of the files that met a certain search parameter. In my code I used a list comprehension for this with a parameter called FileConstraints, but for some reason, when I run the script with a constraint, it is not capable of creating the desired list of filenames. Here is my gist again if there is anyone who can take a look.

So, by the looks of the information you provided to me, do you think I should expand my script to be capable of using pickled array information in npy file format as well? My script is currently able to import npy file formats, but I don’t know how regularly people pickle npy files, as the only instance I have of this was with the npz files that do it natively as arr_0.