2620 3595 Writer backend selector, deprecating nifti_saver/writer, png_saver/writer#3773
2620 3595 Writer backend selector, deprecating nifti_saver/writer, png_saver/writer#3773wyli merged 11 commits intoProject-MONAI:devfrom
Conversation
c122c0e to
a934a49
Compare
88b00c0 to
c4e23df
Compare
|
Hi @wyli , Thanks for the quick update. Thanks. |
|
/black |
a4df129 to
d55e922
Compare
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
6b2e6d8 to
f86ce2b
Compare
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
| fmt = f"{ext_name}".lower() | ||
| existing = look_up_option(fmt, SUPPORTED_WRITERS, default=()) | ||
| all_writers = im_writer + existing | ||
| SUPPORTED_WRITERS[fmt] = all_writers |
There was a problem hiding this comment.
Hi @wyli ,
Here you use a global dictionary to store the supported format -> writers mapping, while in the image readers we store readers in LoadImage transform with its own supported formats, for example:
https://github.com/Project-MONAI/MONAI/blob/dev/monai/data/image_reader.py#L386
I am not very sure which way is better, the readers way is similar to the Chain of Responsibility design pattern, This global SUPPORTED_WRITERS may be not easy to maintain, especially in multi-threads cases, etc.
Maybe because I was Java / C++ developer before, I usually never use global variables even in python. I prefer to use class to implement complicated logic, because it can maintain self-contained local states. For example you implemented FolderLayout as a class instead of a function.
Glad to see your opinions.
@ericspod @rijobro What do you guys think?
Thanks in advance.
There was a problem hiding this comment.
it's a global dict accessed without global keyword.. I believe it's aSUPPORTED_WRITERS is a module-level variable, it's not a global one.
very common design, for example, scikit-image and PIL used it in a similar way
There was a problem hiding this comment.
OK, I am not sure whether it can work fine if calling SaveImage in multi-thread? I think all our non-random transforms are thread-safe now.
Thanks.
|
Hi @wyli , Thanks for the quick implementation, put some comments inline, I will review the Thanks. |
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
67826e8 to
01853a6
Compare
|
/integration-test |
|
/build |
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
|
/build |
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
696c77e to
0152543
Compare
|
/build |
closes #3595
closes #2620
Description
this is to add a
resolve_writerandregister_writer,update
monai.transform.SaveImageto use the latest API.Status
Ready
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests --disttests.make htmlcommand in thedocs/folder.