Code Monkey home page Code Monkey logo

Comments (4)

SebastianoF avatar SebastianoF commented on August 21, 2024

Design pattern is an open question. Giving up the facade would mean having too many uncategorised options. At the moment the applications are collected under agents (or worker) and the tool is accessible according to their semantic. They are intended to work as drawers where you may the required tools.

e.g. to get to the relabel, you type:

nil.manipulate.relabel(...

To get a segmentation with Otsu you will do:

nil.segment.otsu_thresholding(...

And the classes LabelsManipulate and LabelsSegmenter are hidden from the user, that does not need to remember their names. If the user know what she wants and how to use auto-completion, she should be able to reach the right app, or to know that the app is not there yet.

I was afraid that allowing for direct call (nil.otsu_thresholding or nil.relabel) would remove the categorisation and would make reaching a method with auto-completion more lenghty.

Could be even better if you could do:

import nilabel as nil

nil.segment.otsu_thresholding(...)

Instead of

from nilabel.main import Nilabel as NiL

nil = NiL()
nil.segment.otsu_thresholding(...)

But this I guess has to do with the import method (and the __init__.py in the main root) rather than the class architecture.

So the current choice I made is not the best one. The issue remains open, as refactoring class is well considered, after better importing system.

from nilabels.

SebastianoF avatar SebastianoF commented on August 21, 2024

Currently main is deprecated for agents.AgentsController and it works like:

import nilabels as nis

nis_app = nis.App('optiona_input_data_folder', 'optional_output_data_folder')
nis_app.manipulate.relabel('in_data_or_full_path.nii.gz', ...)

With nis.<tab> you can access tools (acting on numpy arrays or nibabel images), agents (facade of tools acting on paths), and App (facade of facade agents).

Still considering more intuitive names than agents or App. Any idea?

from nilabels.

dzhoshkun avatar dzhoshkun commented on August 21, 2024

Are you using the command design pattern as mentioned here or the facade design pattern?

from nilabels.

SebastianoF avatar SebastianoF commented on August 21, 2024

Facade. Documentation updated, thanks!

from nilabels.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.