DDMAL / pixel_wrapper

Rodan Pixel.js Wrapper
Other
0 stars 1 forks source link

Variablize the number of layers based on input/output ports #24

Closed EricHanLiu closed 6 years ago

EricHanLiu commented 6 years ago

Idea to try:

  1. create ~8 optional input and output ports
  2. in get_my_interface() create an array of layer_urls
  3. only add to the array if the url is non-empty (follow if statement structure)
  4. Pass this array as the context to the index.html w/ django
  5. in the index.html create an array variable with this array from controller, count length
  6. Create the img objects based on the non-empty urls
  7. Use the length in Pixel source to create the number of default and required layers dynamically

ALSO NEED TO:

  1. disable the create/delete layer buttons if we're using the pixel_wrapper (not the standalone)
  2. Maybe do this by passing a parameter when pixel is created as a plugin? or in the standalone pixel add a quick check as to whether or not the wrapper elements are present
  3. Ensure the number of input and output ports is the same
EricHanLiu commented 6 years ago

Finished the idea, works properly now with a variable amount of input and output ports.

Note that the number of input/output ports for layers should be the same, excluding the mandatory layer 0 output port (background layer)

Now just need to disable the create and remove layer buttons in the wrapper.

vigliensoni commented 6 years ago

Oh, great!

On Wed, May 30, 2018 at 11:55 AM, Eric Han Liu notifications@github.com wrote:

Finished the idea, works properly now with a variable amount of input and output ports.

Note that the number of input/output ports for layers should be the same, excluding the mandatory layer 0 output port (background layer)

Now just need to disable the create and remove layer buttons in the wrapper.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DDMAL/pixel_wrapper/issues/24#issuecomment-393215648, or mute the thread https://github.com/notifications/unsubscribe-auth/AAeCxUXPULiNeJykqcxg8e7lra-_FGqQks5t3sDegaJpZM4USPqL .

EricHanLiu commented 6 years ago

Moved the mandatory layer 0 output port to always contain the backgroundLayer (this layer is now added at front of the layers list instead of the end). Number of layers should be variablized now, running some tests.

@vigliensoni we need to discuss whether those buttons will be kept!

EricHanLiu commented 6 years ago

It works!

One caveat is that the user must have the same amount of optional input and output ports. The input ports should exclude the background layer that gets output from CM. The number of optional output ports that the user creates should be the number of layers of classification excluding the background layer, which is the mandatory port (layer 0). Otherwise the Rodan job will fail.

In other words, each optional input layer (say PNG - Layer 3 Input) should have a matching optional output layer (say rgba PNG - Layer 3 Output).

This goes in hand with the creation and deletion of layers, which should be discussed first.

EricHanLiu commented 6 years ago

Doesn't seem like it's possible to get the number of output ports from within a job (the controller only passes to the view in the get_my_interface() method, which only has inputs within its scope (not outputs).

I've asked Andrew and he says he doesn't know how/if it's possible to get the number of output ports from within a job's scope.

It seems like the best solution perhaps is to just enable the buttons if there's no inputs (so the user is creating the ground truth), and then specify in the tutorial that they must create the same number of layers as the output ports. We'd disable the buttons otherwise.

EricHanLiu commented 6 years ago

Created checks in standalone Pixel.js code for:

Only create the create/deleteLayerButtons if we're in one of those two cases.

Pull request

EricHanLiu commented 6 years ago

Pull request accepted, this issue should be solved now. Will run some final trials and close if all goes well!

EricHanLiu commented 6 years ago

Pull request for actual pixel_wrapper changes which implement this entire issue's solutions.

EricHanLiu commented 6 years ago

pull request accepted