niftynet filename in T1 is empty - imaging

ValueError raised
I've been using NiftyNet and it has been working before, but recently I've encountered this problem with it not recognizing the T1 or T2 images I think?
There is a valueerror raised because the filename list column passed to [T1] is empty, but from the picture you can see that it recognizes 16 subjects, it used to be 8
I have also included an image of what it was before. The difference is that now I broke my image into 1 label per label file as opposed to the 10 labels per label file it had before:
when it worked
the only changes I made in the config file were 1) I changed the segmentation num_classes value from 11 to 2, and 2) I changed where the path_to_search in my T1, T2, and Label sections to where I put the edited images

Check again the path of T1. This error is often raised when there are no files on that path. Also be sure that the names are correct. They should be the same as before. If you changed the name you should also change them in the datasplit file. Also make sure that the filename of input image and its ground truth are matching.
These are some of the first things that you should check.

Related

Importing .csv WITHOUT the NA in empty cells

Six years ago this guy asked my question...
Getting rid of NA values in R when importing a CSV file
...but no final answer showed up because he never displayed his data
Here is an image of my data in a.csv file. If you need it as code, just say so and I will supply (I just used the RAND() function in Excel to create it).
There are no "missing values" in the usual sense. It just that some columns have more, others less. I will never need to invert so it need not be rectangular. All the "empty" cells are always at the bottom. AND rm.na does not work as I need to operate on each column separately with a special function that does not take rm.na as an argument. How can I import this into R with NOTHING in the cells which are empty. I have tried readxl, RStudio, using Excel instead of .csv, lots of different approaches. Most of them want me to eliminate rows with NA in them. That does not work, either.
Thanks for anyone who can help

When trying to save pgAdmin result to a file (TXT) the result is modified

When I launch my query into pgAdmin 4 v5's Query Tool I get this type of data representation (this is also what I would like to get in my export file).
Unfortunately this information is transformed when saving it to a .TXT file by clicking the following button and saving it as indicated in the subsequent image.
As you can see below, after double-clicking on the saved TXT document, it added '.0' and wrapped my long character by indicating 'e+29' up to a certain row.
Can you please indicate me how to remove those transformations ?
All,
I found out the above problem is linked with the version of pgAdmin I was using, pgAdmin 4 v5 precisely.
After downloading pgAdmin 4 v6.4 the problem doesn't appear anymore.
I consider this thus as fixed, even if the cause of the problem remains unknown to me.
Thanks for your help.
Brieuc

ImageMagick: How to batch append 4 parts of images into one (2 rows, 2 columns) (I have 500+ images that need to be combined like this)

everyone!
I am using ImageMagick-7.0.10-Q16 on Windows 10. I’ve tried Googling for answers, but I’m still left very confused about how to do this. Most of the answers have been for UNIX and not Windows, I have no idea what it means, or given me errors. I don’t have any experience with coding or Windows PowerShell, so forgive my slowness
I have scanned pages of books that have been split into four pieces of jpg files. The images are named after the page number and the orientation of the corresponding piece. BL=Bottom left. BR=Bottom right. TR=Top right. TL=Top left. (BM=Bottom pieces merged. TB=Top pieces merged). So “BL0001.jpg" is the bottomleft piece of page 1. I’m not mentioning their sizes because I don’t want them to be resized or whatever. I just want them to be combined via append like a puzzle like this:
Combined jpg pieces.
The borders and the text-boxes there are just to demonstrate, and are not to be included
So the files are for example like this:
BL0001.jpg
BR0001.jpg
TL0001.jpg
BR0001.jpg
BL0002.jpg
BR0002.jpg
TL0002.jpg
BR0002.jpg
And so on...
This was the last thing I’ve tried in Windows PowerShell:
magick convert B*0001.jpg +append 0001BM.jpg
magick convert T*0001.jpg +append 0001TM.jpg
magick convert 0001*.jpg +swap -append 0001merged.jpg
This combines 4 parts into one image just like I want it to. I found out adding * works like a wildcard and merges all the images like BR and TR together in one go. But I can’t do that for the page number (in this case ‘0001’ in ‘B*0001.jpg’), because that would merge all the files in the folder into the same image, something I don’t want. So what I want to figure out is to how to “batch” run this command for with a sequential numbering system for the different pages. In other words, use a command to batch combine pieces of an image into one image, but with all the scanned pages in jpg in the folder. I know the commands above create addition files with the merged top and bottom parts before the final merge, but I don’t know how to make this command otherwise. I'm willing to try other commands/things too
Using ImageMagick v7 in a simple Windows BAT script you could do something like this...
#echo off
setlocal EnableDelayedExpansion
for /l %%n in ( 1 1 9999 ) do (
set V1=000%%n
set V1=!V1:~-4!
magick *!V1!.jpg +append -crop 2x1# +swap -append +repage !V1!merged.jpg
)
exit /b
That uses a "for" loop to read all four "*0001.jpg" images at a time into an ImageMagick command. The "set V1=" lines are to make sure the variables have the correct number of leading zeros.
The IM command appends, crops, and appends the four images into the properly ordered output, and writes the image as "0001merged.jpg". Then it moves on to process "*0002.jpg" and so on.
I put a top limit on the number of image sets to process with that "9999" in the "for" command to work with the number of leading zeros. Make sure that number is the same or more than the number of image sets you have. It will just print an error for each loop after it goes over the number of image sets, but no harm done.
Note: Using ImageMagick v7 you should just use "magick" because when you use "magick convert" it emulates IMv6 behavior. You probably won't usually want that.

Dataprep import dataset does not detect headers in first row automatically

I am importing a dataset from Google Cloud Storage (parameterized) into Dataprep. So far, this worked perfectly fine and one of the feature that I liked is that it auto detects that the first row in my (application/octet-stream) .csv file are my headers.
However, today I tried to import a new dataset and it did not detect the headers, but it auto assigned column1, column2...
What has changed and or why is this the case. I have checked the box auto-detect and use UTF-8:
While the auto-detect option is usually pretty good, there are times that it fails for numerous reasons. I've specifically noticed this when the field names contain certain characters (e.g. comma, invisible characters like zero-width-non-joiners, null bytes), or when multiple different styles of newline delimiters are used within the same file.
Another case I saw this is when there were more columns of data than there were headers.
As you already hit on, you can use the following snippet to do mostly the same thing:
rename type: header method: filter sanitize: true
. . . or make separate recipe steps to convert the first row to header and then bulk-rename to your own liking.
More often than not, however, I've found that when auto-detect fails on a previously working file, it tends to be a sign of some sort of issue with the source file. I would look for mismatched data, as well as misplaced commas within the output, as well as comparing the header and some data rows to the original source using a plaintext editor.
When all else fails, you can try a CSV validator . . . but in my experience they tend to be incredibly opinionated when it comes to the formatting options of the file—so depending on the system generating the CSV, it could either miss any errors or give false-positives. I have had two experiences where auto-detect fails for no apparent reason on perfectly clean files, so it is possible that process was just skipped for some reason.
It should also be noted that if you have a structured file that was correctly detected but want to revert it, you can go to the dataset details, select the "..." (More) button, and choose "Remove structure..." (I'm hoping that one day they'll let you do the opposite when you want to add structure to a raw dataset or work around bugs like this!)
Best of luck!
Can be resolved as a transformation within a Flow:
rename type: header method: filter sanitize: true

How to read this line in MATLAB?

I came across the following lines in MATLAB:
m = dir(fullfile(dataset,'*.png'));
m = {m(~[m.isdir]).name};
I understand that the first line is trying to obtain the .png files from a directory. But, what is the second line trying to perform? isdir seems to determine that an input is a directory. That's what I new for that part. But, what is the line trying to perform?
Thanks.
The second line is getting all files that are not a directory and then getting the respective names and storing them into a cell array
m.isdir indicates if it is a folder or not
returns 1 if it is, 0 if not.
~[m.isdir] will indicate which of the values returned from isdir was a 0.
m(~[m.isdir]) grabs all objects in m determined by the logical indexing done above
m(~[m.isdir]).name gets the names of all of them
{m(~[m.isdir]).name} stores them all in cell array
Hopefully this step by step walkthrough helps.
While I am not sure why the second line is necessary because the fullfile(dataset,'*.png') should only return paths that end in .png, which will not be a folder, I guess it is good to check.