Giter Site home page Giter Site logo

Comments (4)

eisen-ai avatar eisen-ai commented on September 3, 2024

I don't know if I understand correctly... you would like to dump your data to disk right after it gets transformed (pre-processed).

You can do that by creating a new transformation:

import uuid

class DumpAsNumpy:
    def __init__(self, fields, path):
        self.fields = fields
        self.path = path

   def __call__(self, data):
       for field in self.fields:
           f_name = str(uuid.uuid4())
           numpy.save(data[field], os.path.join(self.path, f_name)

           data[self.field + '_file'] = f_name

        return data

from eisen-core.

eisen-ai avatar eisen-ai commented on September 3, 2024

Of course this additional transform that dumps data to disk might not have exactly this form. But one instance of this object could be part of the transform chain and therefore save copied of data on the disk.

from eisen-core.

bioinfo-dirty-jobs avatar bioinfo-dirty-jobs commented on September 3, 2024

thanks so much!! I make some confusion I'm interested to use the data normalizated from you tool for extract radiomics. So, I wan to integrate deep learning model with radiomics. I just wondering how to save the data after trasformation on nifty format.

I have tried this code:

tform = Compose([
    read_tform, 
    resample_tform,
    to_numpy_tform,
    crop,
    map_intensities,
    threshold_labels,
    add_channel,
    DumpAsNumpy(fields=['image', 'label'],path="tmp/")
])

dataset = MSDDataset(
    PATH_DATA, 
    NAME_MSD_JSON, 
    'training', 
    transform=tform
)




I miss something .. how can save?

from eisen-core.

eisen-ai avatar eisen-ai commented on September 3, 2024

you would need to write one more transformation which DumpsAsNifti. Right now DumpAsNumpy will dump files into the ./tmp folder (not into /tmp, because you didn't specify '/tmp' but 'tmp/' instead) in numpy format.

from eisen-core.

Related Issues (11)

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.