<commit_before>#include "ofImage.h"
#include "ofAppRunner.h"
#include "ofTypes.h"
#include "ofURLFileLoader.h"
#include "ofGraphics.h"
#include "FreeImage.h"

#include "ofxVolume.h"

#if defined(TARGET_ANDROID) || defined(TARGET_OF_IOS)
#include <set>
// android destroys the opengl context on screen orientation change
// or when the application runs in the background so we need to reload
// all the textures when the context is created again.
// keeping a pointer to all the images we can tell them to reload from a static method
static set<ofImage *> & all_images(){
	static set<ofImage *> * images = new set<ofImage *>;
	return *images;
}
static set<ofFloatImage *> & all_float_images(){
	static set<ofFloatImage *> * images = new set<ofFloatImage *>;
	return *images;
}

static set<ofShortImage *> & all_short_images(){
	static set<ofShortImage *> * images = new set<ofShortImage *>;
	return *images;
}

static void registerImage(ofImage * img){
	all_images().insert(img);
}

static void registerImage(ofFloatImage * img){
	all_float_images().insert(img);
}

static void registerImage(ofShortImage * img){
	all_short_images().insert(img);
}

static void unregisterImage(ofImage * img){
	all_images().erase(img);
}

static void unregisterImage(ofFloatImage * img){
	all_float_images().erase(img);
}

static void unregisterImage(ofShortImage * img){
	all_short_images().erase(img);
}

void ofReloadAllImageTextures(){
	set<ofImage *>::iterator it;
	for(it=all_images().begin(); it!=all_images().end(); it++){
		(*it)->reloadTexture();
	}
	set<ofFloatImage *>::iterator f_it;
	for(f_it=all_float_images().begin(); f_it!=all_float_images().end(); f_it++){
		(*f_it)->reloadTexture();
	}
}
#endif


template<typename PixelType>
static bool loadVolume(ofxVoxels_<PixelType> & voxls, string folder, bool forcePow2=false){
	/*
	 TODO:
	 Loading from url not implemented.
	 */

	ofxImageSequence imageSequence;
	if (!imageSequence.setupLoad(folder)) return false;
	
	// get image attributes
	int w	= imageSequence.getWidth();
    int h	= imageSequence.getHeight();
    int d	= imageSequence.getSequenceLength();
	int channels		= imageSequence.getPixelsRef().getNumChannels();<commit_msg>fixing android.. but not tested..<commit_after>#include "ofImage.h"
#include "ofAppRunner.h"
#include "ofTypes.h"
#include "ofURLFileLoader.h"
#include "ofGraphics.h"
#include "FreeImage.h"

#include "ofxVolume.h"

#if defined(TARGET_ANDROID) || defined(TARGET_OF_IOS)
#include <set>
// android destroys the opengl context on screen orientation change
// or when the application runs in the background so we need to reload
// all the textures when the context is created again.
// keeping a pointer to all the images we can tell them to reload from a static method
static set<ofImage *> & all_images(){
	static set<ofxVolume *> * images = new set<ofxVolume *>;
	return *images;
}
static set<ofxFloatVolume *> & all_float_images(){
	static set<ofxFloatVolume *> * images = new set<ofxFloatVolume *>;
	return *images;
}

static set<ofxShortVolume *> & all_short_images(){
	static set<ofxShortVolume *> * images = new set<ofxShortVolume *>;
	return *images;
}

static void registerImage(ofxVolume * img){
	all_images().insert(img);
}

static void registerImage(ofxFloatVolume * img){
	all_float_images().insert(img);
}

static void registerImage(ofxShortVolume * img){
	all_short_images().insert(img);
}

static void unregisterImage(ofxVolume * img){
	all_images().erase(img);
}

static void unregisterImage(ofxFloatVolume * img){
	all_float_images().erase(img);
}

static void unregisterImage(ofxShortVolume * img){
	all_short_images().erase(img);
}

void ofReloadAllImageTextures(){
	set<ofImage *>::iterator it;
	for(it=all_images().begin(); it!=all_images().end(); it++){
		(*it)->reloadTexture();
	}
	set<ofFloatImage *>::iterator f_it;
	for(f_it=all_float_images().begin(); f_it!=all_float_images().end(); f_it++){
		(*f_it)->reloadTexture();
	}
}
#endif


template<typename PixelType>
static bool loadVolume(ofxVoxels_<PixelType> & voxls, string folder, bool forcePow2=false){
	/*
	 TODO:
	 Loading from url not implemented.
	 */

	ofxImageSequence imageSequence;
	if (!imageSequence.setupLoad(folder)) return false;
	
	// get image attributes
	int w	= imageSequence.getWidth();
    int h	= imageSequence.getHeight();
    int d	= imageSequence.getSequenceLength();
	int channels		= imageSequence.getPixelsRef().getNumChannels();
{'fraction_non_alphanumeric': 0.1358695652173913, 'fraction_numerical': 0.0004528985507246377, 'mean_word_length': 5.682299546142208, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2801702', 'n_tokens_mistral': 1478, 'n_tokens_neox': 1449, 'n_words': 365}