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

Has issues saving #107

Open
Zireael07 opened this issue Apr 1, 2023 · 7 comments
Open

Has issues saving #107

Zireael07 opened this issue Apr 1, 2023 · 7 comments

Comments

@Zireael07
Copy link

Program saves as xml, but only wants to load .ws... Several hours of work went down the drain!

(Yes, I did succeed in making Scharr via convolutions tool, and I was in the process of figuring out how to combine stuff - you know, R channel from image X G from image Y B 0, when I must have clicked something nip didn't like and crashed)

Also: save as never produced a working image file, all of them were all black, even those that were RGB 0-255 according to nips

@jcupitt
Copy link
Member

jcupitt commented Apr 1, 2023

Oh no!

Try File / Recover -- nip2 saves the last 10 workspace edits in a recovery area, you should be able to get your work back.

Yes, .ws files are xml inside, but that shouldn't matter. Just save and load to myfile.ws or whatever and it'll all work.

I'll try assembling your demo images in nip2.

@jcupitt
Copy link
Member

jcupitt commented Apr 1, 2023

For a scharr filter in nip2, try saving this file as scahrr.def:

scharr image
	= (kx ** 2 + ky ** 2) ** 0.5
{
	scharr_matrix = Matrix [
		[ -3,   0,   3],
		[-10,   0,  10],
		[ -3,   0,   3]
	];

	bw = (float) colour_transform_to Image_type.B_W image;
	kx = conv scharr_matrix bw;
	ky = conv (rot90 scharr_matrix) bw;
}

Start nip2, do Toolkits / Edit, then File / Open and load the .def file. A new toolkit should appear, called "scharr".

Load an image, then in the main window click Toolkits / scharr and it ought to work. I see:

image

@jcupitt
Copy link
Member

jcupitt commented Apr 1, 2023

I think you saw black because nip2 defaults to integer convolution. Cast your image to float before calling conv and it should work.

Alternatively you could also redo scharr as an int conv (perhaps add an offset of 128?).

@Zireael07
Copy link
Author

Try File / Recover -- nip2 saves the last 10 workspace edits in a recovery area, you should be able to get your work back.

Thanks, that worked. Attaching my file here so that you can take a look and figure out what is going wrong with save as for images themselves (and I still need a tip on that RGB combining thing - it's trivial in any other library I know but I can't figure it out here)

nipstest.zip

@jcupitt
Copy link
Member

jcupitt commented Apr 1, 2023

In nip2 it's image?band to get a band from an image, and image ++ image to join two images bandwise.

They work for strings and lists too, so:

"abc"?1 == "b"
"ab" ++ "c" == "abc"
[1..10]?4 == 5
[10..1]?8 == 2
[x ** 2 :: x <- [1..]]?100 == 10201

etc etc.

@Zireael07
Copy link
Author

Anything on the saving issue (both xml vs ws and the black image)? This effectively renders nip unusable

@jcupitt
Copy link
Member

jcupitt commented Oct 9, 2024

I think it works fine, doesn't it?

Workspace files are XML internally, but that shouldn't matter. Save as fred.ws, load back again, it should all work.

It shouldn't save black image files, you'll need to give a specific example I can check. What steps exactly did you follow, what format did you save in, etc.

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